Override Jinja block in included template from extending template
<p>I have a Flask project with the Materialize CSS framework. I would like to add <code>class="active"</code> to <code>li</code> element in navigation menu based on the current page the user is viewing. My main template includes a template with the menu, the menu defines a block for each item's class. The rendered template extends main and overrides one of the blocks, but that doesn't work. How can I override a block defined in an include?</p>

<p><code>main.html</code></p>

<pre><code>&lt;div class="menu_container"&gt;
    {% include "menu_items.html"%}
    {% block body %}{% endblock %}
&lt;/div&gt;
</code></pre>

<p><code>menu_items.html</code></p>

<pre><code>&lt;li class="{% block home_active %}{% endblock %}"&gt;Homepage&lt;/li&gt;
&lt;li class="{% block other_page_active %}{% endblock %}"&gt;Other Page&lt;/li&gt;
</code></pre>

<p><code>homepage.html</code></p>

<pre><code>{% extends main.html %}
{% block home_active %}active{% endblock %} #Trying to add class active, doesn't work.
{% block body %}
    # Homepage content goes here
{% endblock %}
</code></pre>