title: Access child variable from an include in parent template
body: <p>I'm trying to specify a variable in a child template and access it from another template which is included in the parent template.</p>
  
  <p>Here's what I'm trying to do (code trimmed to the bare minimum):</p>
  
  <p><strong>child.html</strong></p>
  
  <pre><code>{% set var = 'foo' %}
  {% extends 'base.html' %}
  </code></pre>
  
  <p><strong>base.html</strong></p>
  
  <pre><code>{% include 'bar.html' %}
  </code></pre>
  
  <p><strong>bar.html</strong></p>
  
  <pre><code>{{ var }}
  </code></pre>
  
  <p>At this point, I render the <code>child.html</code> file and nothing is output.</p>
  
  <h2>This is what I've tried:</h2>
  
  <p>If I specify the variable in the <code>base.html</code> file instead of the <code>child.html</code> file, it works.</p>
  
  <p>If I pass the variable in my render call, it works. <code>template.render(var = 'foo')</code></p>
  
  <p>Chaging the base.html file to be <code>{% include 'bar.html' with context %}</code> doesn't fix it.</p>
  
  <p>I am able to access the variable in my base.html file just fine, and in fact, I've managed to create a workaround by adding <code>{% set foo = var %}</code> to my base.html, and changing bar.html to <code>{{ foo }}</code></p>
  
  <p>So concisely put, my question is: Is there a way for a template that's included in a parent template to access a variable set in a child template? (Without having to define a new variable in the parent file like my workaround)</p>