Python, Circular Dependencies, and Singletons
问题 I've dug myself into quite a hole here. I'm working on a Python/Kivy app in PyDev. The app runs off of many systems (about 10), so I shoved them into an engine to handle everything. For ease of access, I grab the engine via (the worst) singletons main.py #main.py from code import engine class MyApp(App): def build(self): engine.GetInstance().Initialize() if __name__ == '__main__': MyApp().run() engine.py #engine.py from code import system1 from code import system2 gEngineInstance = None def