I am new in Python and pycharm ide. I have created one of my own module and importing it in another python file. Both of my python files are in same direcotary and parent directory has been made Sources Root directory.
Now my program is working fine but pycharm ide is showing error in import statement and on hover prompting no such module.
I am not sure if i am doing something wrong please let me know what is the proper way to import a module.
here is my project structure - Main.py is importing Greeting.py and getting error.test is a root directory.
For my case, I had my problem was not resolved by invalidating the cache, My problem was with the directories (packages) and the root directory. Here was my structure.
MyApp:
|
|----my_first_app
|--------my_first_app_files
|--------my_first_app_directories
|----my_second_app
|--------my_second_app_files
|--------my_second_app_directories
So what I did on my editor was I right clicked app:>mark directory as:>sources root
Referrence
Link
invalidate cache and restart resolved the problem.
jetbrains.com/help/pycharm/cleaning-system-cache.html
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With