Python 如何访问子包的模块

Python 如何访问子包的模块,python,package,Python,Package,从这个结构中,我想访问module1.py 访问parent.one.module1不起作用您应该能够通过导入以下内容来访问module1: parent/ __init__.py one/ __init__.py module1.py two/ __in

从这个结构中,我想访问module1.py


访问
parent.one.module1
不起作用

您应该能够通过导入以下内容来访问
module1

       parent/ 
                __init__.py 
              one/ 
                      __init__.py 
                      module1.py
              two/ 
                      __init__.py 
              three/ 
                      __init__.py 
从这里,您应该能够引用
模块1


让我知道这是否有帮助

即使尝试了名称空间包,也没有help@MichaelButscher更新代码解释“不起作用”。如果出现错误消息,请在问题中以正确格式的文本显示完整的回溯。解释您试图从哪个模块导入。这是主模块吗(你是从它开始这个项目的)?我投了反对票,因为你没有把要求的信息添加到你的问题中。因此它太不精确了。@BeenaGates您是否尝试专门导入模块?发生了什么样的错误。如前所述,我们需要知道“不起作用”意味着什么
import parent.one.module1
from parent.one import module1