Rendering freezes viewport when run from python api

python

#1

When rendering from the menu a nice little progress bar appears at the base and it can also be cancelled with Esc key.

When i run the process from here:
bpy.ops.render.render(animation=False)

Which is what the docs suggest everything freezes up and i cant cancel wtih Esc key. I know it is still running as i can see the output in both console and folder. Is there a way to have the same behaviour as clicking on the menu item?

Cheers


#2

You can use invoke:
https://docs.blender.org/api/current/bpy.ops.html#execution-context