How can I get a reference to a module from within that module? Also, how can I get a reference to the package containing that module?
You can get the name of the current module using __name__
__name__
The module reference can be found in the sys.modules dictionary.
sys.modules
See the Python documentation