How do I pass keyword arguments to reactor.callLater

python, twisted

Solution

reactor.callLater(0, some_function, foo="bar")

When a function signature say `**kw` they mean to just pass them as key value arguments (named). What you pass here should be exactly what you would pass if you were calling the function directly.

Problem

I want to call a function with reactor.callLater by passing all the variables by keyword and none by index. ``` reactor.callLater(0, some_function, kw={'foo':'bar'}) ``` This gives an error because kw is not expected ``` ... File "C:\App\Python27\lib\site-packages\twisted\internet\base.py", line 800, in runUntilCurrent call.func(*call.args, **call.kw) exceptions.TypeError: function_result() got an unexpected keyword argument 'kw' ``` These are the docs: http://twistedmatrix.com/documents/8.1.0/api/twisted.internet.interfaces.IReactorTime.html#callLater What can I do about it?

Original source