flask sessions and forms : trouble displaying user's username when chat page buttons are clicked

the solution that worked for me was adding the following lines of code to the python file:

from flask_session import Session 

and

app.config["SESSION_TYPE"] = "filesystem"
Session(app)