Using socket to send another script when the first script is over

hi all, I’m right now trying to do process control using computer socket connection with the robot. For example, I have two .urp or .script file that is generated by Robotmaster, Program1.urp and Program2.urp. I’d like to first send Program1.urp to the robot and wait unit the program is finish then send the second program, Program2.urp to the robot.

Can anyone tell me whether there is any existed code or function that can help me complete the process control?
Thanks!