Udev scripts like this don’t generally run under your user, so if you’re referencing the script as literally ~/.switch_payload, it is going to be looking in /root/.switch_payload
You should make sure the udev rules use the absolute path to the script. Even better would be to put it somewhere...