Python class defined in the same file as another class - how do you get access to the one defined later in the file?

后端 未结 5 1801
迷失自我
迷失自我 2021-01-23 02:06

I\'m very new to Python, I figure this question should be easy to answer.

My problem simplified is this...

I have 2 classes in a File class A and class B. Class

5条回答
  •  醉话见心
    2021-01-23 02:27

    class A:
        def __init__(self):
            print "In A"
    
    class B:
        def __init__(self):
            a = A()
            print "In B"
    b = B()
    

    I think you want something like that.

提交回复
热议问题