Use vars
. For example:
>>> import math
>>> class foo: pass
>>> vars(foo)
{'__module__': '__main__', '__doc__': None}
>>> vars(foo)['fn']=math.sin
>>> foo.fn(2)
0.9092974268256817
>>> vars(foo)
{'__module__': '__main__', '__doc__': None, 'fn': }
As you know, methods are just functions with one more argument.