Forum Archive

Exit app by Pythonista script

Kroli

Hello!

I want to write a useful script in IOS 13.3.1 running the Commands application. The Apple Carplay and Cars Infortaitments don't always make the perfect disconnects. The Waze does not exit correctly. When you connect your phone back to CarPlay, 4 out of 5 times will not start automatically. Pythonista would be a good application to exit Waze via Python. This python script could be run by the Commands app when CarPlay disconnecting. Do you have a solution to exit the app by python?

ccc

I seriously doubt that Apple allows one iOS app to terminate another app.

Ajay

To stop code execution in Python you must first import the sys object. You can then call the exit () method to stop the program from running. This is the most reliable, cross-platform way to prevent code execution. 9apps

Kroli

@ccc

Yes! This is understandable. For this to happen, the sandbox would have to be in the same app-group for the termination to succeed. But what if Python starts the app and another script can stop the running process? Can python under child process a waze?

JonB

No, and no.

While you can launch other apps (if they have a URL scheme), it won't be a child process of pythonista. In fact, iOS prevents apps from using subprocesses altogether.

Kroli

@JonB
Thanks...