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/