Show render progress bar while script is being carried out?

When you press the render button in Blender it will display a render progress bar which also presents a cancel button. I noticed that when running a baking or render progress from a script, the progress bar does not show up. Is there anyway to make it show up while the script is running? Perhaps having the script call some kind of draw method for the progress bar or something?

This is especially an issue for my baking scripts. If anyone knows how this could be done would be greatly appreciated. Thanks.

Thanks CoDEManX. This works great for rendering but seems to cause some unstable behavior when using for baking. For instance, the generated images I’m using for baking will show up on the object before it finishes baking (sometimes getting stuck showing half of the original black generated image and half of the baked one when finished).

And sometimes the various settings I’ve changed for the bake won’t take effect if using ‘INVOKE_DEFAULT’. Also this solution doesn’t work at all for cycles baking I.E. object.bake instead of object.bake_image Thanks for your help. One step closer to figuring it out.

Hi, I know this is old as f, but…
Did u figure it out?
I’ve been trying:
bpy.ops.object.bake(‘INVOKE_DEFAULT’, type=‘NORMAL’)
it seems to work for like a second but it end up crashing.
My idea is to have a progress bar for a section only, and freeze the rest of the UI since I figure going modal instead of execute is slower in the baking process and that’s undesirable and preferably avoidable.
Thanks