PyImport_ImportModule("foo.bar")

S

sndive

I'm trying to import foo.bar in order not to add every single
directory with python files to the search path.
i immediately follow the import with the PyModule_AddObject call to
put the imported module
to __main__ module
but later on PyEval_EvalCode on Py_CompileString compiled code
"foo.bar.baz()" and dictionary of __main__
used for global and local context does not work (I get NameError).

is there an equivalent of import foo.bar as Bar; in c api
or should i call into submodules differently?
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,755
Messages
2,569,537
Members
45,020
Latest member
GenesisGai

Latest Threads

Top