My AT command Software Serial is not available when im using a Software Serial for GPS data

Im using an Arduino Uno and a Dragino LA66 LoRaWan shield. I'm trying to get GPS data and send it to a router using LoRaWAN that then sends it to TTN. I'm sending the data using the AT+SEND command. I attached my GPS sensor and created 2 software serials, 1 for the AT commands and 1 for the GPS data. However, my AT command Serial is always unavailble for writing. I'm guessing this is because the GPS serial is already using the Serial Port. How can i solve this? Below is the code I am using.

#include <SoftwareSerial.h> // The serial connection to the GPS module
#include <TinyGPS++.h>
#include <Arduino.h>
TinyGPSPlus gps;

SoftwareSerial ss(10, 11);
SoftwareSerial gpsSerial(4, 3);

unsigned long lastSendTime = 0;

void setup()
{
	ss.begin(9600);
	Serial.begin(9600);
	gpsSerial.begin(9600);
}
void loop()
{

	while (gpsSerial.available() > 0)
	{
		gps.encode(gpsSerial.read());
	        if (gps.location.isUpdated())
			Serial.println("Latitude: " + String(gps.location.lat(), 6));
			Serial.println("Longitude: " + String(gps.location.lng(), 6));
		}
	}

	unsigned long currentTime = millis();
	if (currentTime - lastSendTime >= 5000) {
		if (ss.available() > 0) sendToTTN();
		else Serial.println("Serial for AT commands unavailable");
		lastSendTime = currentTime;
	}
}

String stringToHex(const String &input)
{
	String output = "";
	for (int i = 0; i < input.length(); i++)
	{
		char hex[3];
		sprintf(hex, "%02X", input[i]);
		output += hex;
	}
	return output;
}

void sendToTTN()
{
	String lat = String(gps.location.lat(), 8);
	String alt = String(gps.altitude.meters(), 8);
	String lng = String(gps.location.lng(), 8);
	String lat_hex = stringToHex(lat);
	String lng_hex = stringToHex(lng);
	String alt_hex = stringToHex(alt);
	String seperator = stringToHex(" | ");
	String payload = lat_hex + seperator + lng_hex + seperator + alt_hex;
	ss.println("AT+SEND=1,2," + String(payload.length()) + "," + payload);
}

I moved your topic to an appropriate forum category @yashranjan1.

In the future, please take some time to pick the forum category that best suits the subject of your topic. There is an "About the _____ category" topic at the top of each category that explains its purpose.

This is an important part of responsible forum usage, as explained in the "How to get the best out of this forum" guide. The guide contains a lot of other useful information. Please read it.

Thanks in advance for your cooperation.

Trying to use two software serial instances is not easy.

Far better better to use an Arduino with enough hardware serial ports.

https://docs.arduino.cc/learn/built-in-libraries/software-serial/

Limitations of This Library

SoftwareSerial library has the following known limitations:
It cannot transmit and receive data at the same time.
If using multiple software serial ports, only one can receive data at a time.

Sorry, I didnt know this, ill do this next time for sure!

Thanks for your response, is there a way to get gps data from the gps sensor without using up a software serial? Or maybe a way to send data using Lora without the use of a Software serial?

There are GPSs that can be read with I2C.

You can send data with an SPI based LoRa module but for LoRaWAN you need to use a LoRaWAN library;

https://www.arduino.cc/reference/en/libraries/mcci-lorawan-lmic-library/

But you would be tight for program space on a Nano with that library. A Nano is also a 5V logic level device and the SPI LoRa modules are 3.3V logic level so logic level conversion circuitry is needed