title: How-to Launch Android Python Script via Shortcut on Homescreen
body: <p>I've scoured the interwebs and couldn't find anything with python, android, and "shortcut" or "home-screen" to appear on the same page. I have pydroid3 installed, working great. I'd like to have a shortcut (ideally on the home-screen) that I can tap once and have it run without opening the IDE for editing. </p>
  
  <p>Making a shortcut to the file, or opening a source file in the file manager will at best just open it in the pydroid3 IDE, at worst state "this file type is not supported."</p>
  
  <p>At the beginning of the script, I have tried putting "#!/user/data/../pydroid_dir/python", but alas the OS doesn't realize I mean to run it directly in the python interpreter. Any solutions or alternative lines of thinking are appreciated!</p>
  
  <p>EDIT</p>
  
  <p>I'm running an unrooted android 9 PIE. I wanted to provide some more details but not quite a solution for any readers. Check out related question: <a href="https://stackoverflow.com/questions/14753742/android-how-to-create-a-homescreen-shortcut-to-launch-a-shell-script">How to create a homescreen shortcut to launch a shell script?</a>. Closest I got was trying <a href="http://play.google.com/store/apps/details?id=os.tools.scriptmanager" rel="nofollow noreferrer">SManager</a> which allows you to create a homescreen shortcut to a shell script. Your shell script could be hardcoded to call python on your script:</p>
  
  <pre><code>/path/to/python /path/to/python/script
  </code></pre>
  
  <p>Unfortunately, if you're phone is not rooted, you may not have permission to execute whatever version of python you're calling outside of the context of the app it was installed for. Also, you have to ensure that your shell and python scripts reside in an appropriate place for execution. If your phone is rooted, SManager seems to have options to let you run the script as root.</p>
  
  <p>pydroid3 allows me to run scripts residing on my internal storage as well as lets them read and write files at that location. That's why I was hoping that there was a pydroid way to create a shortcut (or an alternative python app that does this) since it has appropriate privileges.</p>