I'm not even sure if this is possible. What I'm trying to do is having an object call a method, which would reassign a new class object to the variable
Definition:
class A():
def __init__(self):
self.number = 1
def becomeB(self):
# a method that will assign this variable a class B object
class B():
def __init__(self):
self.name = "I am B"
What I'm trying to achieve:
myObj = A()
myObj.becomeB()
print(myObj.name)
Output: I am B