我想要的是,我有foo.py它从bar1,bar2导入类,他们都需要bar3,例如
foo.py
from src import *
...
Run Code Online (Sandbox Code Playgroud)
src/__ init__.py
from bar1 import specialSandwichMaker
from bar2 import specialMuffinMaker
Run Code Online (Sandbox Code Playgroud)
SRC/bar1.py
import bar3
class specialSandwichMaker(bar3.sandwichMaker)
...
Run Code Online (Sandbox Code Playgroud)
SRC/bar2.py
import bar3
class specialMuffinMaker(bar3.muffinMaker)
...
Run Code Online (Sandbox Code Playgroud)
是否有更有效的方法使bar3可用于bar1和bar2文件,而无需直接导入它?
python ×1