When I need to execute a script-B from script-A, I am using subprocess call to start that script-B in a specific directory-B, but it executes as though it is in the directory-A of the script-A which is calling it with subprocess.
Script-B creates files. The files that it creates should be created in directory-B, but they are generated in directory-A instead.
Below: PATH is directory-B, self is script-B.
I am trying
PATH = some_directory
# Get current script name
self = os.path.basename(__file__)
# Copy old-self to desired directory.
os.popen(f"copy {self} {PATH}\\{self}")
# Open new-self in selected dir
subprocess.call([f"{PATH}\{self}"])