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