I want to call a python function from a C function. I need to import the python module in the c file and call the function I need, but nothing found on internet about this helps me because I actually do a ping pong between Python project and C project. I only run the python project. I load the library(dll) of the C project in python module, and after that I call in python a function from C project (this part works just fine) and after that in C project happends some events and in a callback function I want to call a function from python. Any idea how to do this?
The example found on internet like this one http://www.daniweb.com/software-development/python/threads/31682/calling-python-function-from-cc does't work in this case, because the python interpreter is already initialized and when I try to import the module it crashes...
Thanks!
It's documented in the official wiki ...
http://docs.python.org/2/extending/extending.html#calling-python-functions-from-c