I have this directory structure:
+--myproject
¦ +--code
¦ ¦ +--models
¦ ¦ ¦ __init__.py
¦ ¦ ¦ m.py
¦ ¦ ¦_
¦ ¦
¦ ¦ +--resources
¦ ¦ ¦ __init_.py
¦ ¦ ¦ r.py
¦ ¦ ¦_
¦ ¦
¦ ¦ app.py
¦ ¦
¦ +--venv
¦ .gitignore
¦ requirements.txt
¦_
In m.py
I have:
class M:
pass
and in r.py
I have:
from models.m import M # HERE IS THE PROBLEM!
class R:
pass
...
and in app.py
:
from resources.r import R
Please note that when I want to create the pycharm project, I go to
File --> New Project --> choose myprojec directory as location -->
Create project existing sources --> Open the project in a New Window -->
pip install -r requirements.txt
in pycharm terminal -->
cd code
in my pycharm terminal --> run python app.py
My code is working correctly.
But Pycharm draws a red line under my import. It is giving me a false alarm. I know there should be some setting in Pychram to fix this? What is the fix for this?