Here's my code:
robot = create.Create(3)
Without seeing any documentation or source code, this is a wild guess, but…
I'll bet the
playSongNumber function just sends the robot the play command, without waiting for it to finish, and when you send it a play command while it's already playing something, it ignores you.
If I'm right, then hopefully the API provides some way to wait until it's done. If it doesn't provide that, but it does provide a way to poll the current state, you can do that in a loop (sleeping briefly between each check) until it's done. If it doesn't even provide that, then you have to work out how long the song will take by counting the number of notes (or adding the durations, if one of the numbers in each of those pairs is a duration) and sleep that long.