[maya python] script executes too fast

I’ve got a script that works if run line-by-line, but not otherwise.

1 - reset character controls
2 - import/export meshes on the rig
3 - return character controls to previous state

The control reset doesn’t fully complete before the script gets to the exporting bit. How should I force the script to ‘wait’ until Maya is done with that first step? time.sleep(1) pauses the script correctly, but has no effect on the controls-reset completing…

any ideas?

Have you tried setting currentTime after step 1 to make sure that all rig controls, expressions etc are in the correct state?

You are my hero.

works perfectly!

This forum is a constant catalyst for my brain to go, “oh yes, that.”