Answer the question
In order to leave comments, you need to log in
How to inherit self from parent class to child class which is inside it?
How to implement such a scheme, otherwise I can’t give an exact and intelligible answer
class Test:
def __init__(self, name):
self.name = name
# Дочерний класс ( он находится в классе Test )
class Other:
def get_data(self):
print(self.name) # Должен вывести ответ
Answer the question
In order to leave comments, you need to log in
If you want to do this weird shit
class Test:
def __init__(self, name):
self.name = name
self.other = self.Other(self)
class Other:
def __init__(self, test):
self.test = test
def get_data(self):
print(self.test.name)
a = Test('wohoo')
a.other.get_data()
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question