# Klipper/Jinja2 syntax

**URL:** <https://klipper.discourse.group/t/klipper-jinja2-syntax/24475>\
**Category:** General Discussion\
**Created:** [August 3, 2025, 3:55pm UTC](https://klipper.discourse.group/t/klipper-jinja2-syntax/24475 "2025-08-03T15:55:06Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![Teun888](https://avatars.discourse-cdn.com/v4/letter/t/ebca7d/32.png) [@Teun888](https://klipper.discourse.group/u/Teun888)\
**Post date:** [August 3, 2025, 3:55pm UTC](https://klipper.discourse.group/t/klipper-jinja2-syntax/24475/1 "2025-08-03T15:55:06Z")

</div>

### Basic Information:

Printer Model: Sovol SV08

Can someone tell me what this line exactly does?  
{% set start\_vars = printer[“gcode\_macro \_START\_VARIABLES”] %}

I know it sets a variable. But I’m confused on the printer[“gcode\_macro \__START_\_VARIABLES”] part. Is that the same as doing this: printer.\_START\_VARIABLES? To acces an object in the printer object?

---

<div class="post-metadata">

**Author:** ![Sineos](https://yyz2.discourse-cdn.com/free1/user_avatar/klipper.discourse.group/sineos/32/18_2.png) [@Sineos](https://klipper.discourse.group/u/Sineos)\
**Post date:** [August 3, 2025, 4:25pm UTC](https://klipper.discourse.group/t/klipper-jinja2-syntax/24475/2 "2025-08-03T16:25:50Z")

</div>

- This line assumes you have a “hidden” (starting with \_) macro called `_START_VARIABLES`, i.e. it will not appear in the web interfaces
- For the current macro you set the variable `start_vars` to this scope
- Now you can access values from `_START_VARIABLES` within your current macro, e.g. by doing

```auto
start_vars.my_needed_variable

```

instead of

```auto
printer['gcode_macro _START_VARIABLES'].my_needed_variable

```

---

<div class="post-metadata">

**Author:** ![Teun888](https://avatars.discourse-cdn.com/v4/letter/t/ebca7d/32.png) [@Teun888](https://klipper.discourse.group/u/Teun888)\
**Post date:** [August 3, 2025, 5:09pm UTC](https://klipper.discourse.group/t/klipper-jinja2-syntax/24475/3 "2025-08-03T17:09:22Z")

</div>

ah I see. Thanks.

So if I have this:

```klipper-jinja2
[gcode_macro _global_var]
variable_pause_park:{'x': 0, 'y': 0, 'z': 10, 'e': 1}
variable_cancel_park:{'x': 0, 'y': 350, 'z': 10, 'e': 1}
variable_z_maximum_lifting_distance: 345
variable_pause_resume_travel_speed: 150
variable_bed_mesh_calibrate_target_temp: 65
variable_load_filament_extruder_temp: 250

[gcode_macro QUAD_GANTRY_LEVEL]
rename_existing:QUAD_GANTRY_LEVEL_BASE
gcode:
    {% set mesh_name = "default" %}
    {% set mesh_calibrate_temp = printer['gcode_macro _global_var'].bed_mesh_calibrate_target_temp|int %}

```

Then mesh\_calibrate\_temp is just set to 65. Is that correct?

---

<div class="post-metadata">

**Author:** ![system](https://global.discourse-cdn.com/free1/uploads/klipper/original/1X/64419bf2aac6639e6ef5cef200dcd456b0a01ac3.png) [@system](https://klipper.discourse.group/u/system)\
**Post date:** [October 2, 2025, 5:09pm UTC](https://klipper.discourse.group/t/klipper-jinja2-syntax/24475/4 "2025-10-02T17:09:50Z")

</div>

This topic was automatically closed 60 days after the last reply. New replies are no longer allowed.
