'Python - overcome the project path problem on importing

My project structure is:

main.py
----gui/load_ui.py
----gui/resource.py

in load_ui.py I am importing resouce.py.

in main.py im importing load_ui.py since it's pretty much the main code. I can't merge those files (load_ui.py and resource.py).

when running main.py I'm getting the error:

    from resource import *
ModuleNotFoundError: No module named 'resource'

I guess the reason is because of the path of main.py, since i'ts in the outer folder, it doesn't "see" resouce.py file, so it can't import it.

but what can I do so it will work without importing resouce.py on main.py?



Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source