En Mon, 06 Apr 2009 13:58:12 -0300, Roberto Fichera <ker...@tekno-soft.it>
escribió:
I've embedded python v2.6.x engine into my application without any
problem.
Now I would like to inject some additional functions after importing a
python module.
So, basically I'm importing a python module via PyImport_ImportModule()
function.
The python module is a simple set of functions and I would check if some
functions
does exist or not, than if doesn't I would add it from my C application.
Checking if
a function does exist or not isn't an issue, it works without any
problem, my problem
is only how to inject a new function in an already imported module.
Easy (so I wonder whether I misunderstood your question):
some_module.function_name = new_function_object
or
setattr(some_module, function_name, new_function_object)
or
use PyObject_SetAttr/PyObject_SetAttrString in C code.
--
Gabriel Genellina
--
http://mail.python.org/mailman/listinfo/python-list