Is there any way to force update compositing nodes through the Python?

Compositing nodes are not updated if there is no “Compositing” window open. Is there any way to update the compositing node tree or re-composite render with compositing nodes without having the compositing window opened?

Simple example

If there is no open compositing window - compositing nodes don’t recalculate.

I need to add different images on different frames, I can change them with the compositing Image node via a script, but they don’t update with render.

Try setting some value in the node tree through Python, that used to to help me with material updates on animation.

I’m changing the value of the Alpha Over node in this simple example.

See the accepted answer to this question

It cannot be used for animation. I need to change the vatermark each frame.The render process is still exists, user just pressed “ctrl + f12”. I handled render_pre handler and regenerate watermark image on this event. Then I need to update Image in the compositing node tree. I do this, but compositing does’nt recalculates and I have no regenerated watermark on render. So after watermark regeneration I can not start render one more, render process is still running. And this way is not working.
Anyway start render two times is not seems good idea, additional render costs time.

Maybe you can work around this by using handlers like in this answer here. If the render animation command doesn’t work in this case either, you could at least “listen” for a render complete event on a single frame, and start the next frame using the shared list approach from the answer.

Write my custom butch render for animation? Maybe, but it seems very dirty solution.

Any luck with this? Ran into the same issue. Trying to composite on a different scene plus no compositing window.

I don’t find any clear solutions (

Seems to be a common issue with no solution.

i would like to relive this thread because im facing quite the same problem:
I need to update the contents of a window that is not visible.
I perform all the updates by code, but dont seem to have any effect on the datablocks nor on the window GUI.
The other question i have is, if it is possible to access a window object, when this window is not visible.
Ive tried two options:

(1) accessing through:
which doesnt make really sense since it holds only the current window and is readonly

(2) accessing through
for wm in bpy.context.window_managers:
for win in

but again, im accessing thorugh the bpy.context which holds the current context/state of the application windows.

(3) another test:
access through

for ws in
      for scr in ws.screens:

which would be the proper way since im accessing, but then i havent found any way to access the window object from either the workspace or the screen object.