Reputation: 9905
Say, my project structure is as following:
project_folder:
__init__.py
another_folder:
__init__.py
main_file.py
other_file.py
And main_file.py
contains next code:
import other_file as whatever
PyCharm (PEP8) highlights this line as an error 'no module named other_file
' and there is no autocomplete on any calls like whatever.this_should_be_autoc_suggested
. Meanwhile interpreter works perfectly fine.
What can be the cause of this annoying behaviour?
Upvotes: 7
Views: 4213
Reputation: 2232
You need to mark your project directory as "Sources Root", just right click upon the directory in pycharm, Mark Directory as, Sources Root. that should make the trick for you.
Upvotes: 10