How do I inform PyCharm of the location of custom modules?

前端 未结 1 1852
醉梦人生
醉梦人生 2021-02-09 16:54

I have an application at work that is set up with the following structure.

/project_root
    /applications
        /app1
            __init__.py
        /app2
           


        
相关标签:
1条回答
  • 2021-02-09 17:26

    The solution to this was a two step process:

    1. Add the pkg directory as a source root. Do this by selecting File -> Settings -> Project -> (select the project) -> Project Structure then select the pkg directory and add by clicking the Sources button. Click Ok.
    2. Then select File -> Invalidate Caches / Restart -> Invalidate and Restart

    Wait for PyCharm to restart and rebuild it's cache / scan the indexes. Now the pkg directory is detected as a source root and my errors are gone.

    0 讨论(0)
提交回复
热议问题