title: How can I run a coroutine but not wait for it?
body: <p>I have a non-async function that looks like this:</p>
  
  <pre><code>def do_stuff(on_finished):
      result = # complicated calculations here
      on_finished(result)
  </code></pre>
  
  <p>The callback I pass in looks more or less like this:</p>
  
  <pre><code>async def on_finished(self, result):
      response = await post_over_http(result)
      self.last_status = response.status 
  </code></pre>
  
  <p>When I call <code>do_stuff</code>, what I want to happen is this:</p>
  
  <ol>
  <li><code>do_stuff</code> executes and calls <code>on_finished</code></li>
  <li><code>on_finished</code> executes, posts the result over HTTP, and then returns immediately.</li>
  <li><code>do_stuff</code> now returns immediately.</li>
  <li>Later, the HTTP response comes back, and execution returns to the second line of <code>on_finished</code>.</li>
  </ol>
  
  <p>Critically, I <strong>don't want do_stuff to be async</strong>. For architectural reasons, I want <code>do_stuff</code> isolated from the asynchronous nature of the network code, so I don't want to have to make it async just because some code using it is async.</p>
  
  <p>In JavaScript this would be no problem - with basically the above code directly transcribed to JavaScript, I'll get the desired behavior. <code>onFinished</code> would return a Promise which <code>doStuff</code> doesn't wait for and returns immediately, but when the Promise resolves later the second line of <code>onFinished</code> runs. Is this possible in Python? I'm unsure of how to achieve it. With the above code I think I just create a coroutine in the last line of <code>do_stuff</code> but never call it.</p>