How to change the data send on Flask? [duplicate]

from flask import Flask, render_template
import time
import threading

msg = "msg1"

# utility to change msg variable
def change_msg(delay=20):
    global msg
    msg = "msg2"

app = Flask(__name__)

def home():
     return render_template("home.html")

def user():
     return render_template("index.html", msg=msg)

if __name__ == "__main__":
    # spawn a thread that changes value of msg after a delay
    t = threading.Thread(target=change_msg)
    t.start(), debug=True)