Right now I am running a wsl ubunutu terminal and have a python script in a directory that is different to the home directory. I can get it to run a single command to it like 'ls' but i want to cd in to the directory and then run the python script on Ubuntu.
So far I have used subprocess.run as well as subprocess.popen and both of them have gotten me the same thing which returns the base directory of of Ubuntu.
sub=subprocess.run(['wsl',"~","ls"],capture_output=True)
To change the directory and run the Python script, you can make use of the os module in Python along with subprocess.run. Here's a modified version of your code: import subprocess import os