First, imagine the following file structure:
project-dir
|_
package1
|_
__init__.py
module1.py
module2.py
And the following script contents:
module2.py:
def func_module2():
print('func_module2 run')
module1.py:
from package1 import module2
module2.func_module2()
The following command creates an error when executed from the project-dir:
python package1/module1.py
Error:
Traceback (most recent call last):
File "./package1/module1.py", line 1, in <module>
from package1 import module2
ImportError: No module named 'package1'
Why is this happening and how is it possible to run a Python script from another directory?
Python 3.5.2

lsto check if you are in theproject-dirdirectory.python -m package1.module1.