class C:

    def m(self):
        print('original')
c1 = C()
c1.m()

def replacement(self):
    print('replaced!')
C.m = replacement
c1.m()
C().m()
Python - how can I override the functionality of a class before it's imported by a different module?