 
                        我现在有 A.py 和 B.py ,互相import了,A.py里有一个a变量,B.py里有一个b类。
在A.py里,有如下语句:obj1=B.b()。
在B.py里,有如下语句:obj2=A.a。
现在问题是,运行B.py,不报错,没问题。
运行A.py,会报如下错误:
Exception "unhandled AttributeError"
'module' object has no attribute 'b'Copyright 2014-2025 https://www.php.cn/ All Rights Reserved | php.cn | 湘ICP备2023035733号
循环引用了
建议搜搜 Python 的相关介绍
好好规划项目结构目录是比较好的解决方法