Describe the bug
The call-block of an imported macro is unable to use the other imports - because instead of looking at the call-side's import context, it searches for the imports in the file that it was imported from.
To Reproduce
repro.tar.gz
File section.jinja:
{% macro render(title) %}
<section>
<h1>{{title}}</h1>
<div>{{caller()}}</div>
</section>
{% endmacro %}
File element.jinja:
{% macro render() %}
<div class="myElement">{{caller()}}</div>
{% endmacro %}
Root template (page.jinja):
{% import "section.jinja" as section %}
{% import "element.jinja" as element %}
{% call section::render("sectiontitle") %}
{# the element scope is not found because it's looking in section's import context #}
{% call element::render() %}
elementcontent
{% endcall %}
sectioncontent
{% endcall %}
Workaround
A dirty hack to workaround this, is to add the same element import in the section.jinja file.
Askama version
7610b37
Rust version
rustc 1.90.0-nightly (b03b3a7ec 2025-06-26)
Describe the bug
The call-block of an imported macro is unable to use the other imports - because instead of looking at the call-side's import context, it searches for the imports in the file that it was imported from.
To Reproduce
repro.tar.gz
File
section.jinja:File
element.jinja:Root template (
page.jinja):Workaround
A dirty hack to workaround this, is to add the same
elementimport in thesection.jinjafile.Askama version
7610b37
Rust version
rustc 1.90.0-nightly (b03b3a7ec 2025-06-26)