I have a Component
class:
class Component:
def __init__(self, entity):
self.__entity = entity
And I have a TestComponent
class which inherits from Component
:
class TestComponent(Component):
def __init__(self, entity):
Component.__init__(self, entity)
print(self.__entity)
Then I create an instance:
comp = TestComponent(entity)
When I run the code I get this error: AttributeError: 'TestComponent' object has no attribute '_TestComponent__entity'
This makes no sense to me as it doesn't seem to be accessing the variable from the parent class...
Does anyone know how to fix this?
I also tried changing Component.__init__(self, entity)
to super().__init__(self, entity)
and super().__init__(entity)
, none of which are working either.