Mavlink Connection Awaits

I am trying to connect to Pixhawk 7 using pymavlink protocol “the_connection = mavutil.mavlink_connection(‘/dev/ttyUSBx’, baudrate=yyyyyy)” but it keeps on waiting till for the connection to establish until I run mavsdk example “all_params.py”. What could be the issue here and how can I solve this. I would be a great help. How does QGC and Mavsdk send message to start streaming messages. Is there a particular method call or a specific line because the basis of the two is mavlink I think. What could be those methods to start streaming. The same can be implemented in mavlink then. Because mavlink does not send request to broadcast messages or waits for first heartbeat to connect. There was some help at discord community but still trying to figure this out.

It could be because PX4 doesn’t start sending MAVLink until it receives some MAVLink (e.g. heartbeats).

My connections are as follows: The Holybro 6X or Pixhawk 7 is connected to my pc at usb port through TELEM2 port on the board using ttl2usb converter. The code I am currently using is as follows:
#!usr/bin/env python3

from pymavlink import mavutil
import time

connect_to_drone=mavutil.mavlink_connection(‘/dev/ttyUSB0’, baudrate=921600)

print(1)

connect_to_drone.wait_heartbeat()

print(2)

print(“Heartbeat from System (system %u component %u)” % (connect_to_drone.target_system, connect_to_drone.target.component))

while True:
msg=connect_to_drone.recv_match(blocking=True)
print(msg)
time.sleep(0.1)

That should work. Have you enabled MAVLink at that baudrate on Telem2?

MAV_1_CONFIG=TELEM 2
MAV_1_FLOW_CTRL = Auto-detected
MAV_1_FORWARD = Enabled
MAV_1_Mode = Onboard
MAV_1_RADIO_CTL = Enabled
MAV_1_RATE = 100000 B/s
SER_TEL2_BAUD = 921600 8N1