Search code examples
pythonpycharm

PyCharm does not see source root


I have marked the folder as source root but PyCharm still is not able to import from there without warnings. In the given picture I am trying to import from the models to the document.py. How can I fix it?

enter image description here

enter image description here


Solution

  • Once you're inside a folder, you don't really see where you are. Source root contains packages and it's not a package on its own, so to be able to import models, you gotta make its parent folder (api) a source root.

    This is also better because you have code next to models, in app, and it's part of the source as well. ;)