PyCharm highlights lines of importing modules
Asked Answered
P

1

1

PyCharm highlights lines of importing modules (only made by me modules) with red wavy line and give warning "Unresolved reference 'module_name'". But they all (my modules) are located in common package "main". In spite of this unexpected behavior, code is executed correctly.

On linked picture, you can see code/project tree/warning

How to avoid this warnings?

picture of code; project tree; warnings

Parboil answered 24/7, 2020 at 12:13 Comment(2)
Please add your code, project tree and warnings as text, not as an image.Jotun
Please read How to Ask and also Please add a Minimal Reproducible Example that illustrates your issue.Kato
B
2

On the left pane, you should define where the root directory of your code it is.

Go to relevant directory (on left pane), right click on the mouse, on bottom you have mark directory as and then select "source root".

You may select various roots, in case of documentation (the python building scripts), testing, or also some utility tools. But you should explicitly tell PyCharm were the main directory of the project it is.

Breann answered 24/7, 2020 at 12:24 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.