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?
One more technique, which doesn't import the sys module, and arguably - depends on your taste - simpler:
current_module = __import__(__name__)
Be aware there is no import. Python imports each module only once.