I have a directory structure that can be simplified like this: test/ scripts/ a.py src/ b.py In a.py, I have the line: import src.b If I'm in the test directory, I want this to work: python3 scripts/a.py If I'm in the scripts directory, I want this to work: python3 a.py How can I accomplish this? If I move a.py to the top level, it works. I don't want to call the script using python -m scripts.a. Do I need to import sys and add '..'? Do I need an init.py in the src directory? Do I need relative imports using import ..src? Does the current directory vs the script directory matter? Continue reading...