Is there a way to get object reference of an existing object, in an embedded Python code?
In other words: If an object called 'obj' already exist (created by a script), and I need to "convert" it to a PyObject* reference, is there a function like: PyObject *getObjectReference(char *name) ?
EDIT: As a way of example, let's say I import some module in one part of the code, by using
PyRun_SimpleString("var = 1");
(Or as well it could be an external script defining the same variable)
Now, in another point of the code I want to get that variable. I'm looking for something like
PyObject *varPy = PyObject_GetGlobalObject("var");
"reading a global variable of python in c" partially answer my question by implicitly saying that it is not possible to retrieve a global defined variable without having a reference to the module that created it. Is this correct?