I want access to parent self from class inside class
I cant send Parent object to child
Without this solution
parent.Child('Bob jn', Parent)
Like this but this code dosnt work:
class Parent:
def __init__(self, name):
self.name = name
class Child:
def __init__(self, name):
self.name = name
self.parentName = Parent.self.name
def main():
parent = Parent('Bob')
child = parent.Child('Bob jn')
print(parent.name)
print(child.name)
print(child.parentName) # I nedd this print 'Bob'
main()
I nedd this output:
Bob
Bob jn
Bob