What I’m trying to do would look like this in the command line:
>>> import mymodule
>>> names = dir(mymodule)
How can I get a reference to all the names defined in mymodule from within mymodule itself?
Something like this:
# mymodule.py
names = dir(__thismodule__)
Just use globals()
http://docs.python.org/library/functions.html#globals