I'm trying to set the self.role under credential class to use the self.role under AXL class. the idea is to have different classes based on the role the api needs to be. if axl class is only reading data then the role would be r.
PATH = 'home_drive_'
PLATFORM = 'Linux_'
ITEM = '_PC'
class Credential:
def __init__(self, path, platform):
self.role = 'rx'
self.username_file = path + platform + ('The role should be the same as AXL role: ' + self.role)
class AXL(Credential):
def __init__(self, path, platform, item):
super().__init__(path, platform)
self.role = 'r'
self.item = item
def final(self):
return self.username_file + self.item
reg1 = AXL(PATH, PLATFORM, ITEM)
print('AXL role:', reg1.role)
print(reg1.username_file)
print(reg1.final())
the result would be
AXL role: r
home_drive_Linux_The role should be the same as AXL role: rx
home_drive_Linux_The role should be the same as AXL role: rx_PC
Instead of rx, I need to see r
Here is a link to the sandbox