After a few more tests, I found that calling
nis anything large enough to leave enough time to click on Ok to get to the app you want to open works. Apparently, the clock stops when the Pythonista isn't active, and so it doesn't stop waiting until we get back.
Browsing other answers, I saw people using
Scene.pause()for this, and I coupled it with
time.sleep()in a loop, to wait some time before repeating. It seems to work fine, but I'm not sure I used
sceneright, and maybe it's just the
sleep()that stops the script until the app regains foreground.
I did think about chaining scripts though, thank you.
I've been trying to automate the export of Omnifocus tasks to Due, & for that I need to use Due's url scheme repeatedly in the script. You can see an example in this gist: https://gist.github.com/4b3561200491814c5538 . It looks like
webbrowser.open(url1) print 'Done 1.' webbrowser.open(url2) print 'Done 2.'
No exceptions are raised, & the output is
Done 1. Done 2.
As if all calls were made. Why does it not open the url, come back to Pythonista, & open the next one?