Due to refactoring/reworking on a controller I've had to embed a Python Interpreter inside a C application. I can now call python functions and pass/get Objects into Python fine.
The python code is a controller for a robot (currently simulated), this now needs make use of some C code for comparisons I'm making.
Previously the Python code created objects, read sensors, ran control code and wrote the outputs to motors. All of this except the control code now needs to be done in C. The problem I have is that Objects which are created in an init function (in python) which, when I come to run the control code no longer exist.
What is the best way to solve this? My idea was to return the controllers from the init function and store references to them in the C, passing the reference to the controller each time it is called.
Thanks for any help.