我有2个文件位于同一文件夹中。我想使用另一个文件中的功能。我正在将文件1导入文件2,并尝试在其中使用函数,如下所示:
文件1:
def foo()
file2
import file1
file1.foo()
我收到此消息:
AttributeError: module 'parser' has no attribute '__all__'
我也尝试导入如下功能:
from file1 import foo
file1.foo()
但随后我收到此消息:
ImportError: cannot import name 'foo'
我做错了什么? python版本3.6.5