Multiple UAVs Data Fetching in SITL

I have set up the PX4 SITL environment and am trying to retrieve critical flight data from each UAV. For UAV1, I am using [#!/usr/bin/env python3

import asyncio
from mavsdk import System

async def run():
drone = System()
await drone.connect(system_address=“udp://:14540”)

print("Waiting for drone to connect...")
async for state in drone.core.connection_state():
    if state.is_connected:
        print("Drone discovered")
        break

# Start the telemetry tasks
asyncio.ensure_future(print_battery(drone))
asyncio.ensure_future(print_gps_info(drone))
asyncio.ensure_future(print_flight_mode(drone))
asyncio.ensure_future(print_position(drone))
asyncio.ensure_future(print_ground_speed(drone))
asyncio.ensure_future(print_attitude(drone))
asyncio.ensure_future(print_imu_data(drone))
asyncio.ensure_future(print_barometer_data(drone))
asyncio.ensure_future(print_fixedwing_metrics(drone))

while True:
    await asyncio.sleep(2)

async def print_battery(drone):
async for battery in drone.telemetry.battery():
print(f"Battery: {battery.remaining_percent * 100}%")
await asyncio.sleep(2)

async def print_gps_info(drone):
async for gps_info in drone.telemetry.gps_info():
print(f"GPS info: Number of Satellites: {gps_info.num_satellites}, GPS Fix Type: {gps_info.fix_type}")
await asyncio.sleep(2)

async def print_flight_mode(drone):
async for flight_mode in drone.telemetry.flight_mode():
print(f"Flight Mode: {flight_mode}")
await asyncio.sleep(2)

async def print_position(drone):
async for position in drone.telemetry.position():
print(f"Latitude: {position.latitude_deg}, Longitude: {position.longitude_deg}, Altitude: {position.relative_altitude_m}")
await asyncio.sleep(2)

async def print_ground_speed(drone):
async for velocity_ned in drone.telemetry.velocity_ned():
horizontal_speed = (velocity_ned.north_m_s2 + velocity_ned.east_m_s2) ** 0.5
print(f"Ground Speed: {horizontal_speed} m/s, Vertical Speed: {velocity_ned.down_m_s} m/s")
await asyncio.sleep(2)

async def print_attitude(drone):
async for attitude in drone.telemetry.attitude_euler():
print(f"Roll: {attitude.roll_deg}, Pitch: {attitude.pitch_deg}, Yaw: {attitude.yaw_deg}")
await asyncio.sleep(2)

async def print_imu_data(drone):
async for imu in drone.telemetry.imu():
print(f"Acceleration: x={imu.acceleration_frd.forward_m_s2}, y={imu.acceleration_frd.right_m_s2}, z={imu.acceleration_frd.down_m_s2}“)
print(f"Magnetometer: x={imu.magnetic_field_frd.forward_gauss}, y={imu.magnetic_field_frd.right_gauss}, z={imu.magnetic_field_frd.down_gauss}”)
await asyncio.sleep(2)

async def print_barometer_data(drone):
async for pressure in drone.telemetry.scaled_pressure():
print(f"Barometric Pressure: {pressure.absolute_pressure_hpa} hPa")
await asyncio.sleep(2)

async def print_fixedwing_metrics(drone):
async for metrics in drone.telemetry.fixedwing_metrics():
airspeed = metrics.airspeed_m_s
throttle_percentage = metrics.throttle_percentage
climb_rate = metrics.climb_rate_m_s
print(f"Airspeed: {airspeed} m/s, Throttle: {throttle_percentage}%, Climb Rate: {climb_rate} m/s")
await asyncio.sleep(2)

if name == “main”:
asyncio.run(run())], and for UAV2, I am using [#!/usr/bin/env python3

import asyncio
from mavsdk import System

async def run():
drone = System()
await drone.connect(system_address=“udp://:14541”)

print("Waiting for drone to connect...")
async for state in drone.core.connection_state():
    if state.is_connected:
        print("Drone discovered")
        break

# Start the telemetry tasks
asyncio.ensure_future(print_battery(drone))
asyncio.ensure_future(print_gps_info(drone))
asyncio.ensure_future(print_flight_mode(drone))
asyncio.ensure_future(print_position(drone))
asyncio.ensure_future(print_ground_speed(drone))
asyncio.ensure_future(print_attitude(drone))
asyncio.ensure_future(print_imu_data(drone))
asyncio.ensure_future(print_barometer_data(drone))
asyncio.ensure_future(print_fixedwing_metrics(drone))

while True:
    await asyncio.sleep(2)

async def print_battery(drone):
async for battery in drone.telemetry.battery():
print(f"Battery: {battery.remaining_percent * 100}%")
await asyncio.sleep(2)

async def print_gps_info(drone):
async for gps_info in drone.telemetry.gps_info():
print(f"GPS info: Number of Satellites: {gps_info.num_satellites}, GPS Fix Type: {gps_info.fix_type}")
await asyncio.sleep(2)

async def print_flight_mode(drone):
async for flight_mode in drone.telemetry.flight_mode():
print(f"Flight Mode: {flight_mode}")
await asyncio.sleep(2)

async def print_position(drone):
async for position in drone.telemetry.position():
print(f"Latitude: {position.latitude_deg}, Longitude: {position.longitude_deg}, Altitude: {position.relative_altitude_m}")
await asyncio.sleep(2)

async def print_ground_speed(drone):
async for velocity_ned in drone.telemetry.velocity_ned():
horizontal_speed = (velocity_ned.north_m_s2 + velocity_ned.east_m_s2) ** 0.5
print(f"Ground Speed: {horizontal_speed} m/s, Vertical Speed: {velocity_ned.down_m_s} m/s")
await asyncio.sleep(2)

async def print_attitude(drone):
async for attitude in drone.telemetry.attitude_euler():
print(f"Roll: {attitude.roll_deg}, Pitch: {attitude.pitch_deg}, Yaw: {attitude.yaw_deg}")
await asyncio.sleep(2)

async def print_imu_data(drone):
async for imu in drone.telemetry.imu():
print(f"Acceleration: x={imu.acceleration_frd.forward_m_s2}, y={imu.acceleration_frd.right_m_s2}, z={imu.acceleration_frd.down_m_s2}“)
print(f"Magnetometer: x={imu.magnetic_field_frd.forward_gauss}, y={imu.magnetic_field_frd.right_gauss}, z={imu.magnetic_field_frd.down_gauss}”)
await asyncio.sleep(2)

async def print_barometer_data(drone):
async for pressure in drone.telemetry.scaled_pressure():
print(f"Barometric Pressure: {pressure.absolute_pressure_hpa} hPa")
await asyncio.sleep(2)

async def print_fixedwing_metrics(drone):
async for metrics in drone.telemetry.fixedwing_metrics():
airspeed = metrics.airspeed_m_s
throttle_percentage = metrics.throttle_percentage
climb_rate = metrics.climb_rate_m_s
print(f"Airspeed: {airspeed} m/s, Throttle: {throttle_percentage}%, Climb Rate: {climb_rate} m/s")
await asyncio.sleep(2)

if name == “main”:
asyncio.run(run())], both utilizing MAVSDK. When I run these scripts independently, they work perfectly: the script for UAV1 retrieves data for UAV1, and the script for UAV2 retrieves data for UAV2. However, when I run both scripts simultaneously in separate terminals to receive real-time data from both drones, both scripts end up fetching identical data from only one UAV. Does anyone know how to resolve this issue? both scripts have separate ports so that they connect on separate drones but i dont know why they are fetching identical data when i run both scripts at once.