As title. the class set a attribute value inside inner class. then, access that inner attribute class from outer function. In below, attribute sets with inner function set_error. then, use outer function last_error to access the error.
class Device:error_info = ''def __init__(self):self.identify = self.Identify(self.error_info)def last_error(self):return self.error_infoclass Identify:def __init__(self, error):self.error_info = errordef set_error(self, error):self.error_info = errordevice = Device()device.identify.set_error('test')print(device.last_error())