title: Flask/Python - how to update progress bar with running progress
body: <p>I have a process that takes some time and I would like to show a progress bar on a waiting screen and the progress bar updates during the progress untill it is finishes, and it goes to the next page. I have the following code:</p>
  <p>I have a part that renders the waiting screen:</p>
  <pre><code>@app.route('/waiting_screen', methods=['POST','GET'])
  def waiting():
      return render_template(&quot;waiting_screen.html&quot;)
  </code></pre>
  <p>And a part that is handling the processing:</p>
  <pre><code>@app.route('/process',methods=['POST', 'GET'])
  def process():
      file = df
      # Fill database
      for row in df:
          print(row)
      return render_template('finished_process.html')
  </code></pre>
  <p>and my html file of the waiting_screen looks like this:</p>
  <pre><code>{% block content %}
  &lt;div method=&quot;POST&quot;&gt;
      &lt;h4 style=&quot;text-align:center&quot;&gt; Busy processing... &lt;/h4&gt;
      &lt;br&gt;
      &lt;head&gt;
          &lt;div id=&quot;loader&quot;&gt;&lt;/div&gt;
          &lt;div style=&quot;display:none;&quot; id=&quot;myDiv&quot; class=&quot;animate-bottom&quot; &gt;
          &lt;/div &gt;
          &lt;script&gt;
          var myVar;
          function myFunction() {
          myVar = setTimeout(showPage, 3000);
          }
  
          function showPage() {
          document.getElementById(&quot;myDiv&quot;).style.display = &quot;block&quot;;
          }
          document.addEventListener(&quot;DOMContentLoaded&quot;, function(event) {
              waitForMe().then(() =&gt; {
                  window.location.href = &quot;/process&quot;;
              });
          });
          &lt;/script&gt;
      &lt;/head&gt;
  &lt;/div&gt;
  {% endblock %}
  </code></pre>
  <p>This page gives me a waiting animation but because the process is taking quiet long, I really need a processbar.</p>
  <p>I already tried examples where you push the button an the progress bar just runs, but I notice that I don't have the experience to get how my Python function and the script in my HTML page communicate, so I can't get them connected.</p>