How to run different scripts periodically but by running a command on a remote server

So I am trying to make my code do the equivalent of this

ssh -i some-key.pem ec2-user@10.x.x.x 'bash -s' <

but what my code does is block until this command finishes. But it doesnt finish cause its on an infinite loop. So my program doesnt get any response from this command and so it gets stuck. I need to run many scripts periodically using the same command. Any idea how i can make some return to the code while still running the script on a remote machine in the background?