a.by文件
def add(x,y):
print(x,y)
b.py文件
import a
a.add(1,2)
运行
Traceback (most recent call last):
File "f:\ck.py\b.py", line 2, in <module>
a.add(1,2)
AttibuteError: module 'a' has no attribute 'add'
鼓捣好久还是这个错误,真的想吐了.后来发现解决错误的办法非常简单,更想吐了.
解决方法:必须先把a.by文件运行之后,b.py文件才能运行成功.