I have a function and a flask route setup. However, when I go to "simplepage", I get an error "NameError: global name 'aaa' is not defined". Why aren't any of the objects being passed to testfun? Is this something due to the app.route decorator, or due to flask? Can I make all the objects passed to testfun? My actual code is way more complicated with many more objects that would need to be passed, but this simplified scenario was created to illustrate my issue.
def testfun():
b=aaa
@app.route("/simplepage/", methods=['GET'])
def simplepage():
aaa=1
testfun()
return flask.render_template('page.html')