Importing Module From Sub-directory Works In Python 2, But Not Python 3
So I have directory with following structure: > current_directory > submodule /__init__.py /some_module.py /main.py In the __init__.py file the follo
Solution 1:
In python 3 relative imports are supported only in the form from . import submodule
.
You should either rewrite your import
statement or make the import absolute by adding project directory to python path:
export PYTHONPATH=current_directory
python main.py
Post a Comment for "Importing Module From Sub-directory Works In Python 2, But Not Python 3"