PyCharm error: 'No Module' when trying to import own module (python script)

前端 未结 14 1791
醉话见心
醉话见心 2020-12-07 07:57

I have written a module (a file my_mod.py file residing in the folder my_module). Currently, I am working in the file cool_script.py t

14条回答
  •  攒了一身酷
    2020-12-07 08:13

    my_module is a folder not a module and you can't import a folder, try moving my_mod.py to the same folder as the cool_script.py and then doimport my_mod as mm. This is because python only looks in the current directory and sys.path, and so wont find my_mod.py unless it's in the same directory

    Or you can look here for an answer telling you how to import from other directories.

    As to your other questions, I do not know as I do not use PyCharm.

提交回复
热议问题