It is necessary to transfer the variable from jinja2 to the base template. If the call to the test function on python occurs via url, then everything works correctly. But it is necessary to call the send_user_login_status function with any change in the url. In this case, it does not work. How to make it so that the function send_user_login_status worked on any change in the url and sent variables using jinja2. The flask framework is used.
base.html - base template
<li class="{{ login_status_class }}"> {{ login_status }}</li> test.html - test page
{% extends "base.html" %} Python function - works
@app.route('/test') def test_api(): login_status_class = 'login' login_status = u'Enter' return render_template("base.html", login_status=login_status, login_status_class=login_status_class) Python function - not working
def send_user_login_status(): login_status_class = 'login' login_status = u'Enter' return render_template("base.html", login_status=login_status, login_status_class=login_status_class)