The original command was not interpreting the ; before myps properly. Using sh -c fixes that, but... ( please see Charles Duffy comments below ).

Using a combination of single/double quotes sometimes makes the syntax easier to read and less prone to mistakes. With that in mind, a safe way to run the command ( provided the functions in .profile are actually accessible in the shell started by the subprocess.Popen object ):

subprocess.call('ssh user@box "$(typeset -f); myps"', shell=True),

An alternative ( less safe ) method would be to use sh -c for the subshell command: