I managed to solve the problem. I used the “gameStart” event and called a shell script in parallel (If the script was not run in parallel, retroarch would only start after the shell script was fully executed).
case $1 in
And I delayed the execution of the python script.
python3 /userdata/system/tweakvec.py --preset PAL-M