Off board mode connection errors

I’m trying to connect to my pixhawk via Mavlink with custom python code using Off Board Mode, however I get 2 errors every time I try:

  1. Location Position Error
  2. Global Position Error

when I connect with Mission planner, there are no issues, I can arm and fly it. The number of the sattelites is always more than 10.
I basically want to control the pixhawk with commands from my laptop via Mavlink. Does anyone know what I’m doing wrong here?
Thanks in advance

Off board mode is PX4 firmware. This is a ArduPilot forum.