How to issue two successive move commands

When I issue two successive commands of the form

enc_tgt(1, 1, 20)
fwd()
enc_tgt(1, 1, 40)
bwd()

it looks like only the last one gets executed. How do I make it execute the commands so that it goes forward by 20 steps and then goes back by 40 steps? Do I have to make it go to sleep after the fwd()? If so how do I figure out how long to sleep? Or does it need to be done some other way? Do I need to check the status? Thanks!!!

You need a sleep in there. You might try reading the encoder values to figure out when to stop sleeping. But your script above is going to send commands immediately.

Awesome!!! Thanks John.