How to launch getattr function in python with additional parameters?
Yes, but you don't pass them to getattr()
; you call the function as normal once you have a reference to it.
getattr(obj, 'func')('foo', 'bar', 42)
If you wish to invoke a dynamic method with a dynamic list of arguments / keyword arguments, you can do the following:
function_name = 'wibble'
args = ['flip', 'do']
kwargs = {'foo':'bar'}
getattr(obj, function_name)(*args, **kwargs)