Getting the world context to spawn an actor

I am trying to spawn a group of actors after parsing through a file to get some features which would apply to these actors.

The workflow I’m using is -
Parse file → create objects → Apply these features to a Mesh object (AActor). I find that the best way to apply these features while spawning an actor would be to use

FQuat RotationEdge(0.0f, 0.0f, 0.0f, 0.0f);
FVector origin(0.0f, 0.0f, 0.0f);
UWorld* World = GEditor->GetEditorWorldContext().World();
FTransform SpawnTransform(RotationEdge, origin); 
MeshActor* MyDeferredActor = Cast<AMeshActor>(UGameplayStatics::BeginDeferredActorSpawnFromClass(World, AMeshActor::StaticClass(), SpawnTransform)); 

//-----Make Changes to the MyDeferredActor object-----//

UGameplayStatics::FinishSpawningActor(MyDeferredActor, SpawnTransform);

This code worked well when I was putting all of it in the Actor Component Class and then would drag a point light actor in the editor and add this particular component to it. But now I want it to happen as independent actor spawning.

I am not able to figure out what the world context would be to spawn these actors (Since one of these would be the first actor to be spawned). I tried getting a world context from the GEditor object but that just spawns actors that are visible in the actor list on unreal but not in the editor viewport.

From what I read an actor is always required in the scene to obtain the world context which would be used by other actors to spawn. But then how does the very first actor get spawned?

Is my workflow correct? How should I get the world context so that I can correctly spawn actors?

Instead of GEditor try the world in the GEngine.

GEngine->GetWorld();