It's a better way, as your program will work when you aren't in the root dir when calling it
For example our file tree looks like this:
arson/
__init__.py
__main__.py
builtins.py
(the init file is needed for it to be a package)
You can import builtins.py from main by adding this to __main__.py:
from . import builtins
print(123)
and you can run your code by running python -m arson where arson is the package directory, this will print 123
It's a better way, as your program will work when you aren't in the root dir when calling it
For example our file tree looks like this:
(the init file is needed for it to be a package)
You can import builtins.py from main by adding this to
__main__.py:and you can run your code by running
python -m arsonwhere arson is the package directory, this will print 123