Unbound method must be called with instance as first a <p>So, I have a class, where a class variable is set to the output from a class factory in the <code>__init__</code> method, like so:</p> <pre><code>def MyFooFactory(): def __init__(self, *args): # Do __init__ stuff def MyBar(myFoo_obj): print "MyBar" newclass = type("MyFoo", tuple(object), {"__init__": __init__, "MyBar": MyBar} ) return newclass class Foo: Bar = 0 def __init__(self): if (type(Foo.Bar) is int): Bar = MyFooFactory() def MyBar(a_list): for l in a_list: Bar.MyBar(l) </code></pre> <p>However, when I try this</p> <pre><code>myBar_list = [Foo.Bar() for _ in range(x)] Foo.MyBar(myBar_list) </code></pre> <p>TypeError: unbound method MyBar() must be called with Foo instance as first argument (got list instead)</p> <p>Is this happening because <code>MyBar</code> has the same name in both <code>Foo</code> and <code>MyFoo</code> or is there something else afoot here?</p> <p>For reference, both <code>MyBar</code> methods are supposed to be unbound.</p> <p>Thanks,</p>