from pathlib import Path CWD = Path(__file__).parent {% for f in data.children %} {{ f.var }} = CWD / "{{ f.path }}" {% endfor %}