title: Threading.Timer(5, function) launch every 5 second
body: <p>I'm having a hard hard time with <code>Timer</code> function from threading.</p>
  
  <p>Basically, when my program starts, I want to log stats every x second.</p>
  
  <p>So I thought I could do it with the <code>Timer</code> function (launch function every 5 second).</p>
  
  <p>For now, I did : </p>
  
  <pre><code>from threading import Timer
  def startLogger():
      while True:
          t = Timer(5, function)
          t.start()
  
  
  def function():
      print("hey")
  </code></pre>
  
  <p>But it launch error, so I think it's not the good way to do it.</p>
  
  <p><code>RuntimeError: can't start new thread</code></p>
  
  <p>If someone can give me a clue, it would be appreciated!</p>