I’m learning Python3 + GTK for writing my first Gnome application. I use Gnome Builder to create the project with all files (meson, src …) and it builds and run very fine. Now I create a new py file with a class inside. I want to create an instance of that class from the main py file and so I import my classe file. But however I write the import, I always get an error “ModuleNotFoundError: No module named …”.
My folders and files are :
— myclass.py (contains the class Myclass
In main.py, whatever “from … import” or “import …” line I put, i get an error like “ModuleNotFoundError: No module named …”.
“from myclass import Myclass” => "ModuleNotFoundError: No module named ‘myclass’ "
“import myclass.Myclass” => "ModuleNotFoundError: No module named ‘myclass’ "
When I do the same python code outside Gnome Builder (thus outside a Gnome application built by Builder), it’s working fine while using the same “from … import …” or “import …” syntax.
I believe my issue comes from the root folder used at run time and from the src folder created by Builder for the application. But i didn’t find out how to resolve. If any of you has an idea to help, that woul dbe very grateful. Thank you in advance.