title: Python Flask running background functions returning values
body: <p>I have a Python Flask application that I'm planning to use as a monitor for a robot that drives around (using Player/Stage). Now I'm able to connect with the robot and request information and so on.</p>
  
  <p>Player/Stage sends data about the position of the robot every time interval. I'm stuck with the following:</p>
  
  <ol>
  <li>The information about the position should be displayed in HTML, I was thinking about a jQuery POST that requests the position every 500ms and then updates the html (easy). Is there a better solution?</li>
  <li>Player/Stage also sends the actual location estimation of the robot, I want a background process that can save the data so I can display it (like number 1), I don't see how a cerely background job saves the information it calculates. How can I display the output of a background job and send it to the user (html/json)?</li>
  </ol>
  
  <p>I actually need to manage a couple of background jobs and let them quit depending on the output of another background job. So for example, when the robot drives to a specific point, I quit a job, start another, display its data to the user, and so on.</p>
  
  <p>I hope my explanation was helpful, I'm looking for advice, code samples and anything related.</p>
  
  <p>Regards,</p>