pycharm IDE prompts wrong when importing a custom module, but the actual right

In establishing python project, sometimes in order to distinguish between resources and code, as in the project folder and create a new img src two folders, then import the custom module will display an error, but the result of true feeling awkward. Such as:

Technology sharing pictures

This is because pycharm prompts are looking up from the root directory! Solution, the right-code file folder to select [Mark Directory as] -> [Sources Root] to .

Technology sharing pictures   

 After a normal, clean interface, but also the content can be presented in a custom module, the more fun to write code.

 

Technology sharing pictures

 

 

Guess you like

Origin www.cnblogs.com/liuys635/p/11239033.html