Give commands from python script in raspberry pi

I am working on a quadcopter with ardupilot indoors, so no GPS. I want it to work in an automated manner and accept commands from a python script. The commands required are takeoff, rotate, move forward, stop and land. The pi will be on board so doesn’t have to be wireless. I am a complete newbie to this (both pi and ardupilot) so any help is appreciated. I want to know how to link them (searched about it and found mavlink but don’t know how to give commands from my own python script and not Also, in the move forward command should move it in a constant velocity if possible so that I can set distance to travel.

Take a look at dronekit.

That is exactly what I needed. Thanks

Is there anything similar for controlling a car?

If you look in the ardurover section you can find it.

For a drone, I can only command it using dronekit if I have GPS, how do it it if I have no GPS? Have you used this API for GPS disabled drones?