Passing a variable from Python to Jinja

I'm trying to define a variable in python and have that be used in my Jinja template. My understanding is that this needs to (somehow) get from Python into the Jinja context, but as Octoprint is ultimately making the render call I'm not quite sure how to do this correctly.

I naively tried putting:

myVar = "Hello World"

in and then putting


but to no avail. I'm sure I'm just being dumb!

I believe this is the section of the docs you are looking for (direct link):
Use get_template_vars and return a dict of values, then they can be referenced using the prefix plugin_<plugin id>_


1 Like

Perfect! I figured it would be buried in there somewhere! Thanks :slight_smile: