I am starting a Python project, and I have structured my code in packages and sub-packages in the following way:
FCM
|-- definitions
| |-- Classifiers
| |-- __init__.py
| `-- triggers
| |-- __init__.py
| |-- probability.py
|-- examples
| |-- __init__.py
| |-- compute
| `-- study
`-- source
|-- __init__.py
|-- FastComposedModels_pb2.py
|-- genetic_algorithm
`-- trigger_evaluator.py
Module imports between sub-packages work, however when I try to import the triggers subpackage from inside ./examples or ./source:
import definitions.triggers
I get this error:
ModuleNotFoundError: No module named 'definitions.triggers'
Here's the sys.path variable value:
/apps/PYTHON/3.6.1/INTEL/lib/python3.6/site-packages
/home/projects/FCM
/apps/PYTHON/3.6.1/INTEL/lib/python36.zip
/apps/PYTHON/3.6.1/INTEL/lib/python3.6
/apps/PYTHON/3.6.1/INTEL/lib/python3.6/lib-dynload
/apps/PYTHON/3.6.1/INTEL/lib/python3.6/site-packages/pytz-2017.2-py3.6.egg
/apps/PYTHON/3.6.1/INTEL/lib/python3.6/site-packages/packaging-16.8-py3.6.egg
/apps/PYTHON/3.6.1/INTEL/lib/python3.6/site-packages/appdirs-1.4.3-py3.6.egg
/apps/PYTHON/3.6.1/INTEL/lib/python3.6/site-packages/cycler-0.10.0-py3.6.egg
/apps/PYTHON/3.6.1/INTEL/lib/python3.6/site-packages/nose-1.3.7-py3.6.e
I am using Python 3.6.1 in Linux, however, this does not happen to me in any other platform and python version. I do not understand why I can't find the triggers sub-package. Do I miss something?