A simple and hack way to remember current path after a series of commands like "cd xx", instead of use invoke_shell().
requires paramiko, install:
pip3 install paramiko
example:
from paramiko import Transport
from sshclient_session import SSHClientSession
def main():
trans = Transport(("192.168.1.2", 22))
trans.connect(username="root", password="password")
client = SSHClientSession()
client._transport = trans
client.exec_command('pwd') # path: /root
client.exec_command('cd /home')
client.exec_command('pwd') # path: /home
client.close()
if __name__ == '__main__':
main()