I'm using Linux to log into a server using ssh. Once I'm logged in, I would like to execute a local Python script which uses netcat to run some program on the remote machine (it is therefore required to be logged in to access it).
Locally I can type ./script.py on bash to run the script however if I do it while being connected to the remote server that doesn't work. This is due to the fact that the terminal now is in a directory on the remote machine and no longer in a local one.
So how do I execute my local script against the remote machine while being logged in without copying it over first?