Why does PyCharm not recognize modules and classes created by the user?

-1

Hello, I'm new to python and I recently started working with the PyCharm IDE Community version. About IDE, I really liked one of the best IDE's I've ever used. However one problem I have identified in it is that it does not recognize the modules or classes created by the user, perhaps for it to do this automatically need to be done some configuration before I have not done so. Basically I create the module or class and when I will import into another file, the IDE does not recognize, the module name is underlined red and when I try to write some function of the module to call it, the function does not appear in auto-complete . Even not recognizing, the modules / classes work without problems, you just have to type everything manually without errors that despite the IDE does not recognize, it performs perfectly. I wonder if anyone has had similar problem before and solved it. Do I need to do some configuration so that the IDE recognizes automatically? Thanks in advance for your patience.

    
asked by anonymous 11.12.2017 / 12:03

1 answer

1

This is really a peculiarity of PyCharm, you need to tell PyChar that in the directory where your codes are there are also modules that can be imported.

To do this, just right-click on the folder where your codes are located and go to the "Mark Directory as" option and click the "Sources Root" option. This will be enough for you to accomplish the imports of the modules you create.

    
15.12.2017 / 03:22