Consider the following Python project skeleton:
proj/
├── foo
│ └── __init__.py
├── README.md
└── scripts
└── run.py
In this case f
If you like simplicity, and there are no additional restrictions on what you asked, add one __init__.py
to the scripts
folder, and to any other sibling folders, making them packages, then always use the absolute import form, as you said you do not want proj
as a parent package of those and so there is no __init__.py
there, and then call your scripts (instead) from inside the proj
folder with:
python -m scripts.run
or whatever name you give to other scripts other than run.py
This is similar to option 2 of @matejcik answer, but even simpler.