I am converting my python project into packages, with sub-packages, with modules. The tree structure is as shown below (sorry for the long tree). When I run run.py
, it imports MyEnvironment.environment
which in turn has statements like from station import Station
. It is at this stage that I get an error saying ModuleNotFoundError: No module named 'station'
. I am not able to figure why this is happening. Note that it work when I do sys.append('.\Environment')
, but it should work without it since I already added __init__.py
. Could someone help here?
C:.
├───.vscode
│ settings.json
│
└───DRLOD-Package
│ run.py
│ __init__.py
│
├───MyEnvironment
│ │ agv.py
│ │ environment.py
│ │ job.py
│ │ job_queue.py
│ │ parent_area.py
│ │ path_finding.py
│ │ pdnode.py
│ │ policy.py
│ │ request.py
│ │ station.py
│ │ stats.py
│ │ test.py
│ │ __init__.py
```
In environment.py use from .station import Station