close

[Solved] PyCharm : ‘No Module’ when trying to import own module (python script)

Hello Guys, How are you all? Hope You all Are Fine. Today I get the following error PyCharm : ‘No Module’ when trying to import own module (python script) in python. So Here I am Explain to you all the possible solutions here.

Without wasting your time, Let’s start This Article to Solve This Error.

How PyCharm : ‘No Module’ when trying to import own module (python script) Error Occurs?

Today I get the following error PyCharm : ‘No Module’ when trying to import own module (python script) in python.

How To Solve PyCharm : ‘No Module’ when trying to import own module (python script) Error ?

  1. How To Solve PyCharm : 'No Module' when trying to import own module (python script) Error ?

    To Solve PyCharm : 'No Module' when trying to import own module (python script) Error If your own module is in the same path, you need mark the path as Sources Root. In the project explorer, right-click on the directory that you want import.

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

    To Solve PyCharm : 'No Module' when trying to import own module (python script) Error If your own module is in the same path, you need mark the path as Sources Root. In the project explorer, right-click on the directory that you want import.

Solution 1

If your own module is in the same path, you need mark the path as Sources Root. In the project explorer, right-click on the directory that you want import. Then select Mark Directory As and select Sources Root.

Solution 2

So if you go to

-> Setting -> Project:My_project -> Project Structure,

Just the directory in which the source code is available and mark it as “Sources” (You can see it on the same window). The directory with source code should turn blue. Now u can import in modules residing in same directory.

Summery

It’s all About this issue. Hope all solution helped you a lot. Comment below Your thoughts and your queries. Also, Comment below which solution worked for you? Thank You.

Also, Read