hi there,
i want to do swarming for 2 drones,
one is master with system id 3 and one is follower with system id 2, both of them are connected with the sametelemertry.
i have implemented multiple waypoints for one drone, but now i want to do for 2 drone with swarming.
here is the code

from pymavlink import mavutil
import time

# Define a list of waypoints as (latitude, longitude, altitude) tuples
waypoints = [
    (28.5861474, 77.3421320, 10),
    (28.5859040, 77.3420736, 10)
]

# Start a connection listening on a UDP port
the_connection = mavutil.mavlink_connection('/dev/ttyUSB0', baud=57600)


# Set mode to Guided
the_connection.mav.set_mode_send(
    the_connection.target_system,   # Target system ID
    mavutil.mavlink.MAV_MODE_FLAG_CUSTOM_MODE_ENABLED,   # Mode flag
    4  # Guided mode
)
# Arm the drone
the_connection.mav.command_long_send(the_connection.target_system, the_connection.target_component, mavutil.mavlink.MAV_CMD_COMPONENT_ARM_DISARM, 0, 1, 0, 0, 0, 0, 0, 0)


# Take off the drone to  10 meters altitude
the_connection.mav.command_long_send(the_connection.target_system, the_connection.target_component, mavutil.mavlink.MAV_CMD_NAV_TAKEOFF, 0, 0, 0, 0, 0, 0, 0, 10)


def abort():
    """
    Waits for 7 seconds for the user to input 'abort'. If 'abort' is entered,
    sets the mode to RTL and disarms the motors. Otherwise, continues with the waypoint.
    """
    print("Type 'abort' to return to Launch and disarm motors.")
    start_time = time.monotonic()
    while time.monotonic() - start_time < 7:
        user_input = input("Time left: {} seconds\n".format(int(7 - (time.monotonic() - start_time))))


        if user_input.lower() == "abort":
            print("Returning to Launch and disarming motors...")

            # sets the mode to return to launch(RTL)
            the_connection.mav.set_mode_send(
                the_connection.target_system,   # Target system ID
                mavutil.mavlink.MAV_MODE_FLAG_CUSTOM_MODE_ENABLED,   # Mode flag
                6  # RTL
            )
            # disarms the drone
            the_connection.mav.command_long_send(
                the_connection.target_system,   # Target system ID
                the_connection.target_component,   # Target component ID
                mavutil.mavlink.MAV_CMD_COMPONENT_ARM_DISARM,   # Command ID
                0,   # Confirmation
                0,   # Arm (0) or disarm (1)
                0,   # Unused parameters
                0,
                0,
                0,
                0,
                0
            )
            return True
    return False



# below commented code does not work in drone !
# mode = the_connection.mode_mapping()[the_connection.flightmode]

mode = 4
print(f"{mode}")


while mode == 4:
    time.sleep(10)
    # Loop through each waypoint and send MAVLink commands
    for i, wp in enumerate(waypoints):
        print("Going to waypoint", i+1)
        if abort():
            exit()
        else:
            the_connection.mav.send(mavutil.mavlink.MAVLink_set_position_target_global_int_message(
                10,  # Time boot_ms 
                the_connection.target_system,
                the_connection.target_component,
                mavutil.mavlink.MAV_FRAME_GLOBAL_RELATIVE_ALT,
                int(0b110111111000),  # Use only lat, long, alt fields (position masking accuracy parameter)
                int(wp[0] * 10 ** 7),  # Latitude in degrees * 10^7
                int(wp[1] * 10 ** 7),  # Longitude in degrees * 10^7
                wp[2],  # Altitude in meters
                0,  # No velocity control
                0,  # No acceleration control
                0, 
                0, 
                0,
                0,
                0,
                0  # No yaw, yaw_rate, or type_mask control
            ))

            if abort():
                exit()
            
            time.sleep(5)

    # Set mode to Return to Launch
    the_connection.mav.set_mode_send(
        the_connection.target_system,   # Target system ID
        mavutil.mavlink.MAV_MODE_FLAG_CUSTOM_MODE_ENABLED,   # Mode flag
        6  # RTL
    )

    # disarming the drone
    the_connection.mav.command_long_send(
        the_connection.target_system,   # Target system ID
        the_connection.target_component,   # Target component ID
        mavutil.mavlink.MAV_CMD_COMPONENT_ARM_DISARM,   # Command ID
        0,   
        0,   # Arm (0) or disarm (1)
        0,   
        0,
        0,
        0,
        0,
        0
    )
    
# Close the MAVLink connection
the_connection.close()