Import statement works on PyCharm but not from terminal
You are running foo.py like a script, but you are really using it like a module. So the proper solution is to run it as a module: python3 -m somepackage.foo For the record, another alternative is to edit your path like: export PYTHONPATH=. (Or you could put the absolute directory in there, and of course … Read more