Cannot find reference with own modules
I have the following directory structure:
root/mymodule/
--------------------mymodule/
----------------------------------a.py
----------------------------------b.py
root is in the PYTHONPATH, so importing a in b can be done like this:
b.py:
import mymodule.mymodule.a
However, pycharms inspection tool does not understand this; it will underline the second mymodule above in red. It understands the import if I change it to
import mymodule.a
But that won't work in python.
I can fix this by setting the content root directory in Settings:Project Structure to point to "root" and not to "root/mymodule", but I don't want do that, as inspections will then run on everything that is contained in root, not only on my project.
Do you have an idea how to fix this? How can I control what pathes the inspection considers?
请先登录再写评论。