Change flight mode to Guided_NoGPS

Hello, I am trying to set the flight mode to Guided_NoGPS so I can fly the drone with my custom software. It does arm but it wont take off
here is the code

#Change Flight mode 
            self.Arm_mas.mav.command_long_send(
                    self.Arm_mas.target_system,  # target_system
                    self.Arm_mas.target_component,
                    mavutil.mavlink.MAV_CMD_DO_SET_MODE, # command
                    0, # confirmation
                    193, # param1 
                    5, # param2 
                    20, # param3 
                    0, # param4
                    0, # param5
                    0, # param6
                    0) # param7
            
            
            mesg = self.Arm_mas.recv_match(type='COMMAND_ACK', blocking= True)
            print(mesg)
            print("")
            msg = self.Arm_mas.wait_heartbeat()
            print(msg)
            
            loop = QEventLoop()
            QTimer.singleShot(1000, loop.quit) #equivelant to time.sleep
            loop.exec_()
            
            #ARM
            self.Arm_mas.mav.command_long_send(
                    self.Arm_mas.target_system,  # target_system
                    self.Arm_mas.target_component,
                    mavutil.mavlink.MAV_CMD_COMPONENT_ARM_DISARM, # command
                    0, # confirmation
                    1, # param1 (1 to indicate arm)
                    0, # param2 0 to arm/disarm unless prevented by saftey checks 21196 to force arming/disarming
                    0, # param3 all other params meaningless)
                    0, # param4
                    0, # param5
                    0, # param6
                    0) # param7
            mesg = self.Arm_mas.recv_match(type='COMMAND_ACK', blocking= True)
            print(mesg)

There is no implementation of takeoff in guided_nogps.

So we keep having take off failed. (Error 4) from the command acknowledges, how do we get it to take off?

Takeoff in regular guided mode if you have on board GPS. Then change mode to guided nogps.

I want to fly it without the GPS if possible. The control will be from the keyboard

Use SET_ATTITUDE_TARGET to control the thrust value for takeoff to your desired height. Once it reaches change thrust to NEUTRAL.