I have an example below where I reference self.attrs in self.properties in the base class. If I child class updates self.attrs like in the case of Child1, id like it to be that value when i unpack self.properties. If i do not change it, id like it to be whatever it was in the parent class. See below.
class Parent():
def __init__(self):
self.attrs = {}
self.properties = {
"attrs": self.attrs,
"method": self.parentMethod(),
}
def parentMethod(self):
return "Parent Method"
class Child1(Parent):
def __init__(self):
super().__init__()
self.attrs = {"name": "Bob"}
self.properties = {
**self.properties,
"method": self.childMethod(),
}
def childMethod(self):
return "Child1 Method"
class Child2(Parent):
def __init__(self):
super().__init__()
self.properties = {
**self.properties,
"method": self.childMethod(),
}
def childMethod(self):
return "Child2 Method"