python文件調用另一個文件裡的函數,而那個函數又調用了另一個文件的函數,然後就報錯了。
以下為問題代碼(與錯誤無關的代碼已進行刪減與修改)
main.py
from write.py import *from new_open_delete.py import *......go()
write.py
from new_open_delete.py import *def go(): print('1') run()
new_open_delete.py
def run(): print(2)
Traceback (most recent call last): File "E:/PY Project/pythonProject/Writing Novel/main.py", line 4, in
from
write.py
import * File "E:\PY Project\pythonProject\Writing Novel\write.py",
line
2,
in
from new_open_delete.py
import *ModuleNotFoundError:
No module named
'new_open_delete.py';
'new_open_delete'
is
not a package