How to add a Python script for install/update/restore

We have currently this: Writing app scripts | Yunohost Documentation

scripts/
   - _common.sh   # Some "common" definition, typically custom helpers or global variables used accross all scripts
   - install      # The install procedure
   - remove       # The remove procedure
   - upgrade      # The upgrade procedure
   - backup       # The backup procedure - in fact it only "declares" what should be backup / no actual real backup happens at this point except dumping SQL databases
   - restore      # The restore procedure
   - change_url   # Some apps do also provide a change url script, which corresponds to changing the URL endpoint of the app, which may be as simple as changing the nginx conf, or may involve significant changes in the app DB

I would like to add a python script into the scripts folder and use it in install/update/restore… (I would like to replace the “install python” script parts from _common.sh, see also: Use newer Python than 3.9 ?!? )

It works in principle: Install Python with a python script ;) by jedie · Pull Request #72 · YunoHost-Apps/django-for-runners_ynh · GitHub

But the restore fails, because my script install_python.py is not in the backup, see: YunoRunner for CI line 13002-13027

Think i found a solution:
Store the file into: conf/install_python.py and add cp ../conf/install_python.py "$data_dir/install_python.py" in install and upgrade scripts.

This is also great, because it’s callable in the shell from the data directory, too :wink: