How to run a bokeh server and flask app from a single python file?

I have a bokeh server in which some visualizations are created. The bokeh server is running from the file models.py. Further, a bokeh server is embedded using flask’s server_document module in the file app.py. Is there a way by which I can run both the bokeh server and the flask webapp from a single python file so that I don’t have to create 2 files and it’s easier to deploy on cloud?

This is covered in the docs and linked examples: