SSH into a machine and then launch an interactive command line program

If you pass a command in the arguments ssh runs non-interactively;

$ ssh -t user@localhost echo foo
user@localhost's password: 
foo
Connection to localhost closed.

A solution is to replace the non-interactive shell with an interactive shell in the command passed to ssh:

$ ssh -t user@localhost 'echo foo; exec zsh'
user@localhost's password: 
foo
% 

In your case, to replace the non-interactive shell e.g. with an interactive Bash instance:

import os
os.system("xterm -e ssh -tt -i key.pem -o StrictHostKeyChecking=no ubuntu@ip_address 'yRouter/src/yrouter --interactive=1 user; exec bash'")