Asynchronous action in bottle
<p>I have simple application in written in bottle. I need to run same method each 10 seconds. My first idea was something like this, but it is not working and I think it is ugly solution:</p>

<pre><code>inc = 0
# after run server open /loop page in order do initiate loop 
@route('/loop', method='GET')
def whiletrue():
    global inc
    inc += 1
    print inc
    if inc != 1:
        return str(inc)
    while True:
        time.sleep(1)
        print "X",
</code></pre>

<p>Could you suggest me how to do it in right way?</p>

<p>you can use the threading module to call the method with the Timer command: </p>

<pre><code>from functools import partial
import threading

class While_True(threading.Thread):
     def __init__(self, **kwargs):
         threading.Thread.__init__(self)

     def whileTrue(self, *args):
         print args

     def caller(self, *args):
         threading.Timer(10, partial(self.whilTrue, "Hallo")).start()
</code></pre>

python asynchronous bottle