title: Access Macro Context in Jinja2
body: <p>I want to access variables in the jinja2 macro namespace inside a contextfunction. Say my macro looks like:</p>
  
  <pre><code>{% macro show_var(a) %}
    {{ show_var_context_function("a") }}
  {% endmacro %}
  </code></pre>
  
  <p>and my contextfunction looks like this:</p>
  
  <pre><code>@contextfunction
  def show_var_context_function(context, var_name_string):
    return context[var_name_string]
  </code></pre>
  
  <p>Now I think context should have access to a... this should be stored within the context I would think, but the above code will raise a NameError on a, saying it isn't defined within context. I wonder if this is because the context is supposed to be the context of the template and not the macro?</p>
  
  <p>Anyways, is there any way to access the context of the macro?</p>