Stopping Flask initialization from blocking
<p>I'm adding Flask support to a plugin-based application. On startup, the app instantiates a number of plugin classes. I thought this would be as simple as having Flask kick off when the class is initialized, but instead, the whole app hangs when it hits the Flask startup method.</p>

<p>Consider the following example:</p>

<pre><code>#!/usr/bin/env python

from flask import Flask

class TestClass:
    def __init__(self):
        print('Initializing an instance of TestClass')
        self.app = Flask(__name__)
        self.app.run()
        print("Won't get here until Flask terminates!")


foo = TestClass()
</code></pre>

<p>The second print line won't be evaluated until Flask is terminated.</p>

<p>Is there a sane way to force the <code>app.run</code> into the background so that the class continues its initialization steps, while still having the ability to communicate with Flask throughout the rest of my class?</p>