threading.Timer()
You just need to put the arguments to hello
into a separate item in the function call, like this,
t = threading.Timer(10.0, hello, [h])
This is a common approach in Python. Otherwise, when you use Timer(10.0, hello(h))
, the result of this function call is passed to Timer
, which is None
since hello
doesn't make an explicit return.
An alternative is to use lambda
if you want to use normal function parameters. Basically it tells the program that the argument is a function and not to be called on assignment.
t = threading.Timer(10.0, lambda: hello(h))