我的文件結構如下:/dir/ main.py /src/ functionsfile.py classfile.py在functionsfile具有使用在創建的類的功能classfile。我導入該類from classfile import ClassName(我也試過導入*)。只是在functionsfilewithprint語句中測試函數,它似乎找到了類模塊并使用ClassName就好了,但是當我import將該函數從腳本中functionsfile導入時main.py,它給了我錯誤:ModuleNotFoundError: No module named 'classfile'我嘗試同時導入函數:from functionsfile import function和from functionsfile import *我不知道為什么會這樣?
添加回答
舉報
0/150
提交
取消