Search code examples
pythonself-reference

How to get a reference to a module inside the module itself?


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?


Solution

  • import sys
    current_module = sys.modules[__name__]