I have a query over modules in Python.
Using VSCode I have the following simple code set up:
Demo/
Test.py
z1/
\_\_init\_\_.py
Foo.py
z2/
\_\_init\_\_.py
Screen.py
screen.py contains:
class Screen:
SCREEN_SIZE = [800, 600]
and z2/__init__.py
from z1.z2.Screen import *
and both the following Foo.py and Test.py have:
from z1.z2.Screen import *
print(Screen.SCREEN_SIZE)
why is it when I run Test.py, I get:
[800, 600]
But when I run Foo.py, I get:
File "***\Python\z1\Foo.py", line 1, in <module>
from z1.z2 import *
ModuleNotFoundError: No module named 'z1'
I can changed the z1.z2 in the __init__.py to just z2, but then Test.py doesn't work. Is there any means to have it work for both files?