Calling methods and exchanging objects between components

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.

[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

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.

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

I will be waiting for information on this matter.

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.