# How can I force the Compositor to update via Python?

While working on an Add-on that does node connection stuff, I came across a problem I can not find a solution to anywhere: The compositor nodes are only ever updated / evaluated, as long as there is a compositor space open somewhere. If you for instance have the image editor maximized, compositor node tree changes are not evaluated at all.

I am displaying the result of my Python node reconnections through the Viewer Node in the image editor. As long as somewhere there is a Compositor window open, this works. As soon as you switch that window to something else (like a 3D View), updates are not calculated at all.

here is a .blend file to test this, the GIF below shows how to trigger the behavior I described:

I have tried calling the update, update_tag and evaluated_get methods pretty much anywhere I can think of. Is there a way still to force a refresh?

Compositing output can be updated by rendering without any Render Layers nodes in the compositing node tree.

See documentation about Render Operators

bpy.ops.render.render(animation=False, write_still=False, use_viewport=False, layer="", scene="")


If I am not mistaken this use_viewport parameter seems to be for controlling if the render process is shown in the UI. It is false by default so it should not show the render in the UI unless specified otherwise.

• unfortunately this won't trigger the update either. – aliasguru Jul 4 at 9:41
• Could you share some bit of code to reproduce the issue? – Martynas Žiemys Jul 4 at 9:43
• Did you mean you need to recalculate the compositing output? That happens if you render and do not have any Render Layer nodes. – Martynas Žiemys Jul 4 at 9:54
• I'll update my question with a blend file, script included. In the meantime I'll test your idea with triggering rendering, this might work for such a case, has a lot of side effects though – aliasguru Jul 4 at 11:35
• rendering does indeed trigger such an output update. however, it does a lot more, like opening a render output window, switching to Render Result, etc. I wonder if there is some operator other than that that could be called to trigger these updates? – aliasguru Jul 4 at 11:46