There is such a file structure
The test.py file to start at
from .observer import Observer When performing issues
  Traceback (most recent call last): File "test.py", line 1, in <module> from .observer import Observer ModuleNotFoundError: No module named '__main__.observer'; '__main__' is not a package Help me deal with the import of classes from other files.

Observer1/test.py, then you don’t have anyObserver1module and cannot import submodules from it (and the__init__.pyfile is absolutely useless). Or import the adjacent files as normal modulesfrom observer import Observer, or do not runtest.pydirectly - andreymal 7:33 pmpython -m Observer1.test- andreymal