Imagine I have the following test.py file
import foo
class example1(object):
MyFunc = foo.func
Where foo.py is
def func():
return 'Hi'
Then I write another file
import test
test.example1.MyFunc()
and get the error 'unbound method func() must be called with example1 instance as first argument (got nothing instead)'.
How can I use the function func as an attribute of the class example1?