I have instances of that class calling a function defined elsewhere in the program as its member, and am trying to figure out the notation to initialize the class with a member function that can be called later. Currently, initializing the object initializes the member to the evaluation of that function at the time of that objects instantiation. How do I pass the function to init() in a way that the function itself is the object member, rather than the return value of the function?
Example:
class MyClass:
def __init__(MyFunc):
function = MyFunc()
MyFuncDef():
#Do Something
def main():
MyObj = MyClass(MyFuncDef())
MyObj.function()
if __name__ == 'main':
main()