我有一个文件
`XYZ\Application.py`
包含多个Python文件的包,例如
XYZ\Python\UserInterface.py
Application.py 内部我只是使用 UserInterface ,所以我用
导入它 from Python.UserInterface import UserInterface
(Python文件夹包含__init__.py
(如果这甚至很重要))。但UserInterface再次使用许多不同的文件/模块,这些文件/模块存储在同一目录中并由UserInterace导入。但是,如果我只是说from Reader import Reader
,我会收到ModuleNotFoundError: No module named 'Reader'
错误。我是否真的需要使用Python.whatever
引用包内的每个导入?
答案 0 :(得分:0)
你有没有尝试过:
from .Reader import Reader
或
from Python.Reader import Reader
UserInterface.py
中的