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?
Thanks

Mavproxy

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

pymavlink

from pymavlink import mavutil

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

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

Not enough information… please refer to Download and Installation — MAVProxy documentation

you can also use dronkit

https://dronekit-python.readthedocs.io/en/latest/guide/quick_start.html

Thanks @Zerocool
Sorry for less information.
Could you please point it out what are the information do you need?
That was working till last night. Now the same code is not working but in QGC everything is fine.

Looks like you’re using PX4, not ArduPilot: people might be more familiar using PX4 at discuss.px4.io so that might be a better place to seek assistance.
If you meant to be using ArduPilot, first thing to do would be to flash ArduPilot firmware and see if the problem persists.

Yes right.
You are correct.

Hi @Zerocool & @james_pattison
It resolved by restart the system & with the same code now its working.