Python导入类的对象作为当前类的全局变量

from a import A

class B():

def init(self):
self.a_obj = A()

def b_method(self):
print "calling a_method() from B..."
self.a_obj.a_method()

posted on 2020-11-19 15:30  小白在此  阅读(495)  评论(0编辑  收藏  举报

导航