ModuleNotFoundError error with PyCharm project folder recs

前端 未结 3 1987
别跟我提以往
别跟我提以往 2020-12-23 18:02

I am working on a project in PyCharm. The project has the following structure:

/projectRoot/
   folder1/
       somecode.py
   utils/
       __init__.py
            


        
3条回答
  •  春和景丽
    2020-12-23 18:19

    You can use utils package inside folder1 folder:

    Then the code will work either way:

    from utils.myutils1 import myClass
    

提交回复
热议问题