user1917407 user1917407 - 1 year ago 98
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?

Answer Source

To import as object :

from root.folder1.folder2 import script1

To import a function of your script:

from root.folder1.folder2.script1 import NameOfTheFunction

Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download