Solution
@views.route('/question', methods=['GET','POST'])
def question():
HorK = session.get("HorK", None)
images = []
lessonID = session.get("lessonChoice", None)
quizImages = getQuizImages(lessonID, images)
# this part essentially generates a random image from a set of characters and then the user has to write down the correct sound of that character
# don't worry too much about the variables but the html page needs HorK and an image to run
if request.method == 'POST':
character = Character.query.filter_by(image=request.form.get("image")).first()
answer = request.form.get("answer")
if answer.upper() == character.romaji:
flash('Correct', category='success')
else:
flash('Incorrect', category='error')
image = random.choice(quizImages)
return render_template("question.html", HorK=HorK, image=image)