Let\'s say that I have a class defined in moduleA.py which I want to add a method to, using some sort of loader method that takes a the name of a second module
moduleA.py
There's actually a much simpler way to do this:
class ClassA(object): def __init__(self,config): super(ClassA, self).__init__() self.a = 1 self.b = 2 from moduleB import meth2 as meth1 def calling_method(): return self.meth1()