[edit] Thanks everybody for the help. This did produce an answer and I have marked the correct answer.
[edit] I apologize for this hastily formulated question. I am trying to express what my problem is and the code snippet was written as an abstraction of what I am trying to do. I have added a new subobject of A and I need to be able to call the anotherFunc on the attribute aThing, as well as A's native functions.
I have a class, A, with function func(). I have an instance of A that is being reinitialized constantly.
class B(object):
def __init__() :
self.aThing = A()
def foo(aFunction, args):
self.aThing = A()
self.aThing.aFunction(args)
def bar() :
self.foo(A.func, anArg)
def bam()
self.foo(A.aThing.anotherFunc)
class A(object) :
def __init__() :
self.aThing = C()
def func() :
doSomething
class C(object):
def anotherFunc()
doAnotherThing
x = B()
x.bar()
x.bam()
How do I pass the function func so that it is called on the newly initialized object self.aThing?