Unable to get heartbeat from mavproxy or pymavlink

Unable to get heartbeat from mavproxy or pymavlink, but when I am opening QGC, its getting all the info & I can arm or even takeoff.
I am using real copter & not using any SITL. I am using USB to connect & I changed the parameter CBRK_USB_CHK to 0.
That was working till last night. Now the same code is not working but in QGC everything is fine.
Any idea?


mavproxy.py --master=/dev/ttyACM0 --baudrate=115200


from pymavlink import mavutil

connection = mavutil.mavlink_connection("/dev/ttyACM0", baud=115200)

print("Heartbeat from system {} component {}".format(
    connection.target_system, connection.target_component))

It resolved by restart the system & with the same code now its working.