Calling methods and exchanging objects between components

Forum Forums Visual Components 4.1 Component Modeling Calling methods and exchanging objects between components

Tagged: 

This topic contains 4 replies, has 3 voices, and was last updated by eme eme 1 year, 4 months ago.

Viewing 5 posts - 1 through 5 (of 5 total)
  • Author
    Posts
  • #6361
    Avatar
    nimo
    Participant

    Hello

    I am trying to control the behavior of the component with Python script.

    Is it possible to call classes and methods defined in a Python script of another component from a Python script of one component?

    Also, is it possible to reference Python objects created by one component from another component?

    Thank you.

    #6388
    zesty
    zesty
    Moderator

    [Edited]

    Sorry, I don’t know how to do that unless you are importing a module. If developer reads this thread then maybe they can comment on the scope/namespace of component scripts. Or if someone has an example then please share.

    Otherwise, try this, https://docs.python.org/2/library/weakref.html

    #6396
    Avatar
    nimo
    Participant

    Thank you for your reply.

    For example,
    ———————————————————
    Robot 1 component
    + – Behaviors
    + – PythonScript <— Definition of class & instantiation of that class (1)

    Robot 2 component
    + – Behaviors
    + – PythonScript <—Refer to the instance of (1)
    ———————————————————

    As mentioned above, when referring to the instance of (1) from the Robot 2 component, how should it be described in the Python script of the Robot 2 component?

    Thank you.

    #6401
    Avatar
    nimo
    Participant

    Hello zesty,
    Thank you for your reply. I appreciate your kind reply.

    I will be waiting for information on this matter.

    #6637
    eme
    eme
    Moderator

    I don’t think you can share instances between two python sandboxes in Visual Components. The script typically communicate data with other means. Maybe it is possible to serialize the class/instance and send it as a string etc. but sounds sketchy.

    Could you describe your use case. What are you trying to achieve. Maybe we’ll find another solution for you.

Viewing 5 posts - 1 through 5 (of 5 total)

You must be logged in to reply to this topic.