Pymavlink plane takeoff

Hi, I’m trying to create some simple python script just to takeoff a plane to a specific position, but got stucked with it. There are some tutorial how can do this for copter, but didn’t find useful information about a plane.

The script is next:

from pymavlink import mavutil

the_connection = mavutil.mavlink_connection('udpin:localhost:14551')
the_connection.wait_heartbeat()
print("Heartbeat from system (system %u component %u)" % (the_connection.target_system, the_connection.target_component))

the_connection.mav.command_long_send(the_connection.target_system, 
                                     the_connection.target_component,
                                     mavutil.mavlink.MAV_CMD_COMPONENT_ARM_DISARM,
                                     0, 1, 0, 0, 0, 0, 0, 0)

the_connection.mav.command_long_send(the_connection.target_system, 
                                     the_connection.target_component,
                                     mavutil.mavlink.MAV_CMD_NAV_TAKEOFF,
                                     15, 0, 0, 0, 0, -353621474, 1491651746, 100)

And when I starting to execute it - connection refuses for some reason.
I’m not sure if all provided is correct and probably this is a root cause for this strange behaviour.
Can anyone suggest here? Thanks

çözümü bulabildiniz mi acaba