Combining seperate Dash app with Flask app results in "Error loading layout"

I want to route a Dash app (which is in the separate module through my general flask app (which is in the module

In stand-alone mode the Dash app runs perfectly, but when I route it through the separate Flask app I get an “Error loading layout” on the Dash route.

This is what the modules structure-wise look like. First

def make_dash_app(server=None, url_base_pathname=None):
    _app = dash.Dash(__name__,

    _app.layout = html.Div(
        ...lots of stuff using other functions in the module...
    return _app

if __name__ == '__main__':


# The flask server app
flask_app = flask.Flask(__name__)

def hello_world():
    return 'A static Hello!'

# The Dash app and its route
import dash_app

_dash = dash_app.make_dash_app(server=flask_app,

def render_dash_app():
    return flask.redirect('/dash/')

if __name__ == '__main__':

I guess the problem is somehow related to the module separation, because when I merge both modules into one, it works. But that is not scalable when i want to add more Dash apps. How can I make it work with the module separation?