Command from Pixhawk 4 to Raspberry Pi

Is there a way to do the following.

I flip a switch on my RC transmitter which signals Pixhawk 4 to send a command to Raspberry Pi 3B to execute a python script (i.e. a computer vision script.)