How to make a call from a script that is in another folder

Asked

Viewed 22 times

-1

I am developing a process in which it will be necessary to make a call in a script that is in another directory.

I have a script that is in the directory /home/ant/tests/mobile/myphone.sh

If I needed to make that flow in the shell I would:

FORM_PATH="/home/ant/tests/mobile/" CHECK_CMP="$FORM_PATH/myphone.sh"

How could I make that call in python?

Thank you

1 answer

0

Speak Ant! All right?

I believe your question was very open. When creating your question, always remember to put more details, examples of your code and describe your attempts and errors. For the code, you can use the os.chdir() to change the current directory location. Remember to import the module with the import os.

By changing the directory to the file location you can use something to run your script like subprocess and its method run() which executes commands passed to it in string

Browser other questions tagged

You are not signed in. Login or sign up in order to post.