Skip to content

Klipper Dynamic Macros

Never restart Klipper again for simple macros.

logo


Klipper Dynamic Macros is an unofficial way to update macros without restarting Klipper, so you can update macros mid-print and see their results live. It also supports many extra features that normal GCode Macros don't have.

Discord Shield

Get Started

Features

  • Recursion


    Allow macros to call themselves internally for more complex logic.

    Learn More

  • Receiving Variables


    Allow macros to update their state while running.

    Learn More

  • Utility Functions


    Reusable helpers and shared logic for complex macro systems.

    Learn More

  • Variables & State


    Persistent variables and runtime state across macro executions.

    Learn More

  • Embedded Python


    Use Python expressions and helpers directly inside macros.

    Learn More

  • Rendering & Templating


    Render your macros before running them to quickly iterate on logic.

    Learn More

  • Delayed GCode


    All the above features are also available in delayed_gcode sections.

    Learn More

  • Macro Clusters


    Group related macros into structured, modular systems, with optional safety systems in place.

    Learn More

Normal Macro Dynamic Macro
Macros read once from configuration file Macros read once then reloaded on demand
Requires restart to update macros Updates macros on demand
Does not support recursion Allows recursion
Internal state is fixed within macro run Internal state can be updated during macro run
Does not allow pre-rendering macros Allows pre-rendering macros

Info

Unlike traditional G-Code macros, Dynamic Macros are not included in your printer.cfg and are instead defined in a separate file. They are instead read by a [dynamicmacros] section in your printer.cfg.

Klippy Extras Tutorial

DynamicMacros also includes a tutorial on writing Klippy extras.

Get Started

Examples

See Example Macros for examples of Dynamic Macros.

More Projects

If you like this project, don't forget to give it a star! Also, check out the 3MS, a modular multimaterial system for Klipper!