PyImport_ImportModule("foo.bar")

sndive at gmail.com sndive at gmail.com
Thu Dec 6 21:22:20 EST 2007


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?



More information about the Python-list mailing list