Q: PyObject* to toplevel module

Jason Orendorff jason at jorendorff.com
Tue Dec 11 01:41:15 EST 2001


From: Arno Puder <arno at research.att.com>
> how do I get a pointer to the PyObject instance representing the 
> toplevel module?

  PyObject *main = PyImport_ImportModule("__main__");

In Python, you can "import __main__" or look in sys.modules['__main__'].

-- 
Jason Orendorff   http://www.jorendorff.com/




More information about the Python-list mailing list