Professional Python newbie here. I have created a Python module called aviation
with a file in there called database.py
.
I have another module called core
, with a file in there called calculator.py
.
I want to import aviation.database.py
into my calculator.py
.
The basic structure is as follows:
My project
aviation (module)
- database.py
core (module)
- calculator.py
test.py
My calculator.py
file has an import such as:
from aviation import database as aviation_database
This module is not recognised and I get a red squiggly line indicating as much.
If I create another file test.py
outside of aviation
and core
and add the above import, there are no issues in this tests.py
file - the import works fine.
It appears that I need to do something so that my module can import from another module... it does allow me to import installed modules (like date
), but I have no idea what I am missing.
I am using the IntelliJ IDE and my code is located in the regular C:\Users\\IdeaProjects directory.
Can someone tell me what I should do and why I am facing this problem?