user1917407 user1917407 - 3 months ago 12
Python Question

How do I import a module from within a Pycharm project?

In my project, the file structure is as follows:



I have a statement in that says "import script1", and Pycharm says no module is found. How do I fix this?


To import as object :

from root.folder1.folder2 import script1

To import a function of your script:

from root.folder1.folder2.script1 import NameOfTheFunction