Macro operator pauses after baking

I’m trying to create a macro that does something before and after baking. It’s supposed to bake multiple times.
The issue is that after the first bake is finished, the macro pauses until I move the mouse. Then it bakes the next one.

Is there a way to keep the macro running through all baking operations?

Here’s a file which shows a simplified version of this:

The reason it stops is because there’s no input to generate a callback for the bake modal. You can get around this by adding an event timer to generate a tick. Should kick start subsequent bakes.

1 Like

So if I understand correctly, I should just add something like

> bpy.context.window_manager.event_timer_add(1) to for example my register _bake_macro function?
I’m asking because that doesn’t seem to work.

EDIT:
Specifying the window fixed it!
bpy.context.window_manager.event_timer_add(1,window=bpy.context.window)
Thank you!