Python circular importing?

后端 未结 7 1113
不知归路
不知归路 2020-11-22 05:46

So i\'m getting this error

Traceback (most recent call last):
  File \"/Users/alex/dev/runswift/utils/sim2014/simulator.py\", line 3, in 
    f         


        
7条回答
  •  陌清茗
    陌清茗 (楼主)
    2020-11-22 06:18

    I was using the following:

    from module import Foo
    
    foo_instance = Foo()
    

    but to get rid of circular reference I did the following and it worked:

    import module.foo
    
    foo_instance = foo.Foo()
    

提交回复
热议问题