How to send MAVLink message from MP to RPi by python script?

How do you send MAVLink messages from Mission Planner to companion computer by python script?
I have Pixhawk2.1 Orange and RPi 4B which is connected to TELEM2.

The python script I’m writing will work like below:

  1. Requests a float number imput to MP user
  2. Sets a parameter of a MAVLink message to the number
  3. Sends the message to the RPi
  4. A script running in the RPi listens the message and get the number