class T:
    pass


class A(T):

    def __init__(self):
        print('Creating instance of {}'.format(self.__class__.__name__))


class B(A):
    pass


class C(T):
    pass
A()
B()
C.__bases__ = A,
C()


class D:
    pass
D.__bases__ = A,
D()
How to dynamically change base class of instances at runtime?