Scripting with a managed object using python.net engine
Currently, I am facing an issue to do scripting with a managed object in python engine.
I managed to import the module and set an attribute value to the managed object.
The issue is in the next step where I am trying to use the module in a statement/expression via PythonEngine.RunString or RunSimpleString method.
As far as I know:
RunString() is not working because it always return null value. I tried running a simple expression, e.g., "1 + 1", and it returned null value. I believe the fix here could solve this bug (if it really is...)
RunSimpleString() executes expression from the __main__ module implicitly. I have not found any possible way yet to include the module I've imported in the beginning into __main__ module.
I made a little modification on the code by creating a new class that represents the Python Module object.
This is how I use the modification in my code.
// create __main__ and my own module
PyModule __main__ = new PyModule(PythonEngine.ImportModule("__main__"));
PyModule birdwrapper = new PyModule(PythonEngine.ImportModule("birdwrapper"));
// set the value of the attribute to a managed object