ArduPilot Dronekit scripting a connection

I am trying to write a script that will connect to many drones throughout its execution. I have noticed that the drones are inconsistent with their ports and can often cause timeout errors. Currently this is the script I wrote:

from dronekit import connect, TimeoutError

connection_strings = ['', '', '']
vehicles = []
start = 'tcp:'
temp = 6

for connection in connection_strings:
    connection = start + str(temp) + '2'
    print('Trying ' + connection)
        vehicles.append(connect(connection, wait_ready=True))
    except TimeoutError as err:
        connection = start + str(temp) + '3'
        vehicles.append(connect(connection, wait_ready=True))
    print('Connected to ': ' + connection)

The problem I am encountering is that this just becomes an infinite connection stream for the first connection and never actually results in receiving a heartbeat from any drone. Am I doing the error handling correctly?

I have come to the conclusion that this script is not necessarily incorrect, but that something is actually wrong with my vehicles. I got a message in QGroundControl that said:
prearm: GPS: waiting for home the vehicle has failed a pre-arm check. In order to arm the vehicle, resolve the failure.
How do I resolve this failure?

This error in the comments only occurred after I had changed the location of the drone. When I don’t specify a location the error still occurs now and I am confused on how to fix it.

How do you start the simulated vehicles?

@Mustafa_Gokce I think this isn’t necessarily a problem with the script but more so a problem with my ArduPilot as it just stopped getting the GPS lock from my drones it seems. I still am not sure how to solve this problem…