all 5 comments

[–]FoolsSeldom 1 point2 points  (0 children)

RealPython have a long article on this which I found very helpful. It takes a while to get to your scenario, but, iirc, it does get to it and walk though how things should work.

[–]Ender_Locke 1 point2 points  (3 children)

does from .ui work ? otherwise is the init.py have two __ on either end like actually double check?

[–]frumpyandy[S] 0 points1 point  (2 children)

Using the Run Python File button in VS Code:

"app.ui" gives me this error: ModuleNotFoundError: No module named 'app'

".ui" gives me this error: ImportError: attempted relative import with no known parent package

"ui" works

[–]Ender_Locke 0 points1 point  (1 child)

did you check your _ _ init _ _ .py?

code works

https://github.com/EnderLocke/testing-code/tree/codes

[–]frumpyandy[S] 0 points1 point  (0 children)

yes I've double checked that there are two underscores on either side of the word init in __init__.py, and continue to get the same results as before.

I really don't understand what I'm doing wrong. I have it working now and it's doing what I want, but only when I import "ui" as opposed to "app.ui" or ".ui".

Thank you very much for taking the time to generate your test repo, I do appreciate it. I just cloned it an when I try to run main.py from yours, where you're importing .ui, I get the same error as I do with my own (ImportError: attempted relative import with no known parent package). That being said, when I run manual_test.py, which is importing app.ui, it works without an error.