Connection to UAV using Python Dronekit not reliable

I finally managed to connect to the UAV via Python Dronekit but in a very strange manner. The connection string I use is the following:

vehicle = dronekit.connect('IP_OF_THE_UAV:14550', wait_ready=True, baud = 57600)

This normally doesn’t work! I tried and tried by changing all the parameters without success.
Here the strange fact comes … if I run first APM Planner and let it connect to the UAV, then close it and try the Python script … it works! I can definitely connect to the UAV with the connection string above, read/write parameters and run all other instructions.

The Python script keeps working until I switch off the UAV. At that moment, if I want to make the Python script work, I first need to run APM Planner again, close it and run the Python Dronekit script …

I can’t really understand what is happening thanks to APM planner that make the connection with Python successful afterward. Any idea on that?

Thank you very much :smiley::smiley:

Any ideas on that? :weary::weary::weary:

Is your UAV streaming UDP to the IP you are running dronekit on?