Call a route from within another route in Flask [duplicate]
问题 This question already has answers here : Get json from one view by calling it from another view (3 answers) Closed 4 years ago . I am trying to figure out the best way to get data into my template in a flask app. I have two routes, one to display the index page, and another that just returns json. I am trying to figure out the best way to access this information. Currently I have the following routes: jsonObj = module.queryExternalApi() @app.route("/") def index(chapi=jsonObj): data = getData