Can I call a shortcut from pythonista?

I have a script in pythonista that I’d like to end by calling a shortcut (just a simple shortcut that takes no input, it just stops a Toggl time tracker). I can’t find where in the pythonista documentation they mention anything about how to do this. Is it possible?

1 Like

sure you can.

import webbrowser"shortcuts://run-shortcut?name=StopToggle")

Thank you! This works perfectly :slight_smile:

1 Like

Is there a way to pass input to the shortcut using a URL?

Yes, shortcuts://run-shortcut?name=ShortcutName&input=Some_value

1 Like

I am sorry to ask a question in this topic after three years, but I am hoping that it might be possible to obtain an answer to a question relating to this topic by asking it here. Would anyone know if receiving the output of a shortcut is possible in Pythonista using the URL scheme method suggested in some answers of this topic? Thanks so much if anyone answers.

You can run a Pythonista script using it’s url-scheme and passing some input to it.


I’m guessing you might be able to this this.

  • You script runs and checks for any arguments passed.
  • If arguments exists, assume Shortcuts sent them, so use them
  • If no arguments pass, assume this is before calling the the shortcut
  • …some python statements…
  • Run the shortcut using the Shortcuts’s url-scheme
  • In Shortcuts, do whatever then run the Pythonista script passing the shortcut result as arguments

I just have to try it out

Python Script

# Stored on device, not iCloud

import sys
import webbrowser
import urllib.parse

if len(sys.argv) > 1:
	# value received from shortcuts
	input = urllib.parse.quote("value from Python")

	# run shortcut, send input"shortcuts://run-shortcut?name=SomeShortcut&input="+input)


It took me some time to actually try to implement a pythonista script using the example provided. The problem I am encountering now is that the shortcut returns an output value which I would like to receive in the pythonista script. Would anyone have any idea as to what I need to change in the example provided to be able to accomplish this? Thanks so much.

Maybe I should clarify that it is a Scriptable script that I am trying to call from a pythonista script. Scriptable scripts can be called via URLs like shortcuts can, but the particular script that I am trying to call returns a value. I hope that it is possible to receive the return value in the pythonista script. Thanks again for any suggestions.