Considering two objects A and B with B nested in A as follows:
class Object_A:
def __init__(self, nested_obj):
self.nested_obj = nested_obj
def obj_A_do_domething(var):
var = var * 3
return var
class Object_B :
def __init__(self, var):
self.x = 3
def obj_B_make_A_do_domething():
# how to call upper level obj here?
pass
objB = Object_B(var=3)
objA = Object_A(nested_obj=Object_B)
objA.nested_obj.obj_B_make_A_do_domething()
Can I call a method from a nesting object from the nested one?