Pause script until batchrender is finished

Hello !
I think the title says everything :slight_smile:

I have a script in which I use the batchrender in maya.
But, the rest of the script continue to run even when the batchrender isn’t finished.
Is there a way to pause the script and wait until the batchrender is complete ?

Small question:
How can I apply a shader to a face without selecting the face first ?

Thank you

Was long since I touched renders but want to remember something like what is brought up here

And as for applying shaders to specific faces, I want to remember it being pretty complicated - think I have some code somewhere I did just that with however think I opted for the simpler solution of having the script select the face I wanted - apply the shader then restore selection to what I previously had.

Thank you for your answer !
This is exactly what I was looking for.

But I also read that these Post/Pre Mel do not run with batchRender. I’ll try at home and I’ll come back to let you know !

That’s what I did. I selected the face then I applied the shader. It was the easiest way I could find.