Put this into a file named `force_root.py` ```python import sys, os print("Forcing root") if os.getenv("USER") != "root": os.execv("/usr/bin/sudo",["sudo"]+sys.argv) ``` and put that in your default python path (it needs to be in `root`s `PYTHONPATH`, which you can inspect by running `python -c 'import sys; print(sys.path)'` — for example on the [Kubuntu](/linux/ubuntu/kubuntu) system I'm writing this on, I put it in `/usr/local/lib/python3.10/dist-packages`. Then ```python import force_root #rest of script ``` and this will automatically run `sudo` for you.