Flask - Pass data from different functions to same template

Viewed 1634

So basically I have two functions

@app.route('/index', methods=['GET'])
def do_stuff1():
    *LOGIC*
    return (render_template('index.html', data=data))

and

@app.route('/index', methods=['GET'])
def do_stuff2():
    *LOGIC*
    return (render_template('index.html', moreData=moreData))

How do I pass through the data from the second function to the the same template because it's not working as I have specified there. I'm only getting the first functions data.

EDIT: I should have specified that I want to use the data within the same route.

1 Answers
Related