7

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?

y.selivonchyk
  • 8,987
  • 8
  • 54
  • 77

1 Answers1

10

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.

Jean Guzman
  • 2,162
  • 1
  • 17
  • 27