 <p>As furas suggested in his comment, you could store the counter in the session or perhaps a database. You could also store it as a hidden input field on the form.</p> <p>In your template:</p> <pre><code>&lt;input type="hidden" name="counter" value="{{ counter }}"&gt; </code></pre> <p>In your view:</p> <pre><code>counter = request.form.get('counter', type=int) or 0 return render_template('accounts/test/medium.html', word=word, output=scribble_normalized, counter=counter+1) </code></pre>