I am new to python embedding. I am trying to inject python + numpy code inside a C ++ callback function (inside a dll)
the problem we are facing is the following. if I have:
Py_Initialize();
Py_Finalize();
everything is working fine.
but if I have:
Py_Initialize();
_import_array();
Py_Finalize();
this happens the second time it reaches _import_array (); (this means it works for the first callback)
If instead I initialize python and numpy only once and terminate in the destructor (thus, not every time during initialization / termination), everything fails when exiting the callback.
The problem here, I think it is numpy, but I do not know how to solve it.