title: Python run connexion based application inside functions or methods only
body: <p>I have an application that uses connexion and swagger andd is quite large already. Just like in <a href="https://github.com/zalando/connexion/blob/master/examples/swagger2/sqlalchemy/app.py" rel="nofollow noreferrer">examples</a> of this framework, the connections to database are created outside of any function, or class. I find this approach as a really poor design, and I really feel like there should be one place (e.g. main()), where all the objects necessary are created and some .run() method is called on them.</p>
  <p>The minimum I want is to have at least functions that are registered in swagger.yaml as endpoint handlers, to accept the database connection I provide, not one that has to be created on application start-up and available to all the functions.</p>
  <p>Is there a way to achieve something like this, or do I have to make peace with having database connection created in one file and all the other files import it and use it?</p>