Messages I show with Flask's flash don't leave the page until the page is reloaded. How can I make these messages dissapear after a delay using Python? Answers I have found are for JavaScript, but I'm looking how to do this in Python. Is this not possible with Python? Should I use JavaScript? Why?
<main role="main" class="container">
      <div class="row">
        <div class="col-md-8">
          {% with messages = get_flashed_messages(with_categories=true) %}
            {% if messages %}
              {% for category, message in messages %}
                <div class="alert alert-{{ category }}">
                  {{ message }}
                </div>
              {% endfor %}
            {% endif %}
          {% endwith %}
          {% block content %}{% endblock %}
        </div>
 
    