Passing data to a CommandData plugin from Python
-
Hello,
I have a command plugin that inherits from CommandData, defined and registered in C++. I am trying to create a Python script which calls this command plugin, but I want to pass data to it so it can use that data in its
Execute()
function. I can modify the class in C++ if necessary. Can I do this in Python? I know I can pass data using theMessage()
function, but have not found a way to use that from Python.Thank you for the help,
Daniel -
Hey @danniccs the easiest way would be to have a python script that store something in the BaseContainer of the document, you can also store BaseContainer, this way you could store multiple data in it. Then your C++ code will read these values and act accordingly.
The second way would be to directly call your python script from your C++ plugin as shown in Python - Manual.
Cheers,
Maxime. -
Hi Maxime, thank you very much for your answer! I wasn't sure if storing things in the global document BaseContainer was a good approach, but it's working well.
Cheers,
Daniel