All of this is working except for the final part: updating the formLayout.
-attachControl secondFrame "top" 0 firstFrame
-attachForm secondFrame "left" 0
-attachForm secondFrame "right" 0
-attachControl secondFrame "bottom" 0 lastFrame
myLayout; Generates this error:
Error: line 8: Object 'secondFrame' not found.
...which is a lie because running "deleteUI secondFrame" deletes the UI object. If the object didn't exist I wouldn't be able to run that command, so why is Maya complaining?
The reason I need to do that edit to this formLayout is that I need to re-attach the secondFrame UI-object to the lastFrame UI-object. Right now everything in my script is working except for this final part (as I wrote above), and I end up with a large gap between the second and third frame.