exporting c_variable to embedded python module

Chris Angelico rosuav at gmail.com
Fri Jan 9 00:47:26 CET 2015


On Fri, Jan 9, 2015 at 8:03 AM,  <kenakahn at gmail.com> wrote:
> I'm running a python script loaded via PyImport_Import in my C++ program on Linux.  Is there any way I can pass a value from the c-code to the loaded python module?

To answer this question, first think about how you would like to see
that value on the Python side. Does your C code call a function in
that module? If so, it can pass it a parameter. Or do you want the
top-level import to be aware of something? It might be best to put
something into another module, maybe even builtins. What makes sense
from the Python end? Pretty much anything can be done.

ChrisA



More information about the Python-list mailing list