title: Execute Function Every X Seconds On Class Init
body: <p>I have created a <a href="http://thp.io/2007/python-jabberbot/" rel="nofollow">jabberbot</a> class that I would like to broadcast scheduled messages. I don't have much experience with threads (in any language) but I am having an especially hard time grasping the concept with python.</p>
  
  <p>My lattest attempt was using <a href="http://docs.python.org/library/threading.html#timer-objects" rel="nofollow">threading.timer</a> something like this:</p>
  
  <pre><code>class myBot(JabberBot):
       def __init__( self, jid, password, res = none):
           autoNotify()
  
        def autoNotify():
             #Send timed message
             self.send('someuser@jabber.example.com','cooool message text!')
             #set/reset timer
             t = Timer(05,self.autoNotify)
             t.start()
  </code></pre>
  
  <p>The problem with this is that it continuously spawns new threads until it eventually dies.  I've read numerous examples on SO using third party libraries, messaging queues, and twisted, but my question is simply this - Is there really no easy way to spawn a single asynchronous thread? </p>