Constantly send data form python script on one raspberry pi to python script on another raspberry pi

I have a drone (custom made by someone else form science club and given to me) that was made for a different project so it already has python scripts for controling it through ardupilot (pi connected to pixhawk mounted on drone). What i need to do for my project is to take the location of this drone from that script on the pi and send it to another pi on another drone with the same setup to tell it where to go so they fly together. Right now i’m looking for the easiest way to do that but any help with any stage of this will be greatly appreciated.

So. you have Drone_1 and Drone_2, running the exact same scripts, right?

What code are these Drones running?. Not verbatim, just a snip of the code that will:

My thoughts are that instead of having the Drone_1 send data to Drone_2 (which would require some kind of wireless comms system) could you not have Drone_2 calculate the position of Drone_1, based on its own position data, then have a feedback loop to position Drone_2 relative to Drone_1?

the code is just reading location data that can be simplified to int or string values,
image
So the problem is basically sending an int variable form one pi to another

how would it do that? If Drone_2 has only it’s data and Drone_1 flies in a random direction, how does Drone_2 know where?
not saying that the idea is bad i just don’t understand it

thank you for replying btw, i really appreciate it!

No worries.

So, does the code contain any ‘Drone control’ lines?

Forget the drones for now. How would you transfer data from one pi to another?

Do they have bluetooth? Some other wireless communication?

How do you deal with the prospect of spoofing (a third party attacks your drone by sending fake data, hijacking it, or causing your drone to fly into a wall, or into somebody’s face)?

I know nothing about wireless communication on RaspberryPIs, but that’s what you will need. (Can’t really run a cable between one drone and the other).