def exec_command(self, command, bufsize=-1):
#print \"Executing Command: \"+command
chan = self._transport.open_session()
chan.exec_command(command)
Strictly speaking, you can't. According to the ssh spec:
A session is a remote execution of a program. The program may be a shell, an application, a system command, or some built-in subsystem.
This means that, once the command has executed, the session is finished. You cannot execute multiple commands in one session. What you CAN do, however, is starting a remote shell (== one command), and interact with that shell through stdin etc... (think of executing a python script vs. running the interactive interpreter)