Python issue with inheritence
I'm trying to check if a inherited class is an instance of it's superclass. But the inherited class and the super class are in separate files.
I'm importing the inherited class with importlib as a dynamic import.
So for example:
python1.py:
python2.py:
python3.py:
This prints: MyInheritedClass isn't an instance of MySuperClass
Does anyone know why that is the case?
1 Reply
inheritedClass is a reference to the class itself, not an instance of the class. Hence
isinstance
is False, because it is just an instance of type
.