I’m trying to use Builder to restart something I started a while ago… I’m trying to move something that worked well in gtk3 (done in VSCode) to gtk4 (using Builder).
I can’t get over the first hurdle.
I’ve got main.py file and a module called globals.py.
In main.py, if I add ‘import globals’ at the top the terminal reads ‘ModuleNotFoundError: No module named ‘globals’’
Why?? If I open the folder up in VSCode it’s very happy globals.py is there. It was always so simple! I can’t even find a ‘save project’ button in case it’s a refreshing problem… which I have found happen when I’ve deleted previous modules. Something disappears from the tree but the one I deleted is still there?
When I started the project I set it up as a gtk4 project using Python.
The project seems to be using the meson build system.
So my guess would be that you might not have added the globals.py file to the sources, thus meson does not know that you need the file. Meson then doesn’t bring it along when you then “build” the program, and thus isn’t available when you run it.
Have a look inside the meson.build file in the src/ folder, it should contain something in the direction of:
Yes, @HighKingofMelons is right. I use a different default directory structure and configure meson to package the entire src with install_subdir('src', install_dir: pkgdatadir).
I had forgotten that the directory structure model that Builder creates needs this addition to sources. This isn’t a python issue, it’s a question of how meson works in flatpak.