import __main__
print(__main__.__file__)
More Related Contents:
- What does if __name__ == "__main__": do?
- Importing installed package from script raises “AttributeError: module has no attribute” or “ImportError: cannot import name”
- How to do relative imports in Python?
- How can I import other Python files?
- Installing python module within code
- What exactly is a “raw string regex” and how can you use it?
- How to write a Python module/package?
- Collapse multiple submodules to one Cython extension
- Can modules have properties the same way that objects can?
- What’s the difference between __builtin__ and __builtins__?
- Importing modules: __main__ vs import as module
- Importing installed package from script with the same name raises “AttributeError: module has no attribute” or “ImportError: cannot import name”
- How do I find out my PYTHONPATH using Python?
- How does python find a module file if the import statement only contains the filename?
- Two Python modules require each other’s contents – can that work?
- How to make global imports from a function?
- Python import modules from a higher level package
- Can’t install mysql-python (newer versions) in Windows
- What does if __name__ == “__main__”: do in Python?
- Prevent Python from caching the imported modules
- How can I import a module dynamically given the full path?
- How can I Install a Python module within code?
- ImportError: libSM.so.6: cannot open shared object file: No such file or directory
- Import python module NOT on path
- How to move all modules to new version of Python (from 3.6 to 3.7)
- How to properly use relative or absolute imports in Python modules?
- Importing a library from (or near) a script with the same name raises “AttributeError: module has no attribute” or an ImportError or NameError
- How can I do relative imports in Python?
- How to reload python module imported using `from module import *`
- Recursive version of ‘reload’