Loading blueprint class into level without constructors

I need to load the following Blueprint class into the level at runtime without using constructors. This is done to spawn an actor (Metahuman in this case) at runtime when a user presses a key on the keyboard.

The blueprint callable code for this is as follows

header

UCLASS(Blueprintable)
class FACEANIMATION_API UMetahumanUtil : public UObject
{
    GENERATED_BODY()
    
    UFUNCTION(BlueprintCallable, Category="Metahuman")
    static void SpawnMetahuman(AActor* CurrMH);
};

implementation

void UMetahumanUtil::SpawnMetahuman(AActor* CurrMH)
{
    UE_LOG(LogTemp, Warning, TEXT("Spawning metahuman"));
    
    FString Path = "/Game/Metahumans/Aoi/BP_Aoi.BP_Aoi_C";

    UObject* SpawnActor = Cast<UObject>(StaticLoadObject(UObject::StaticClass(), nullptr, *Path));
    UBlueprint* GeneratedBP = Cast<UBlueprint>(SpawnActor);

    UClass* SpawnClass = SpawnActor->StaticClass();

    UWorld* World = CurrMH->GetWorld();

    FActorSpawnParameters SpawnParams;
    SpawnParams.SpawnCollisionHandlingOverride = ESpawnActorCollisionHandlingMethod::AlwaysSpawn;

    FVector Loc(-60, -10, 40);
    FRotator Rot(0, 0, 90);
    
    World->SpawnActor<AActor>(GeneratedBP->GeneratedClass, Loc, Rot, SpawnParams);
    
    UE_LOG(LogTemp, Warning, TEXT("Spawned metahuman"));
    
}

This will be used in the level blueprint as follows
Screen Shot 2022-07-11 at 6.17.50 PM

This is not working because GeneratedBP variable is null.

I was hoping to get some pointers on how to do this. Most of the questions I came across on the forum use constructors for doing something similar.

Thanks.

By changing the implementation as follows, the generated blueprint class is not null anymore, and the asset is loaded

void UMetahumanUtil::SpawnMetahuman(AActor* CurrMH)
{
    UE_LOG(LogTemp, Warning, TEXT("Spawning metahuman"));
   
    UWorld* World = CurrMH->GetWorld();

    FActorSpawnParameters SpawnParams;
    SpawnParams.SpawnCollisionHandlingOverride = ESpawnActorCollisionHandlingMethod::AlwaysSpawn;

    FVector Loc(-60, -10, 40);
    FRotator Rot(0, 0, 90);
    
    TSoftClassPtr<AActor> MetahumanClass = TSoftClassPtr<AActor>(FSoftObjectPath(TEXT("/Game/Metahumans/Aoi/BP_Aoi.BP_Aoi_C")));
    UClass* AssetClass = MetahumanClass.LoadSynchronous();
    
    UE_LOG(LogTemp, Warning, TEXT("AssetClass name is %s"), *AssetClass->GetName());
    
    World->SpawnActor<AActor>(AssetClass, Loc, Rot, SpawnParams);

    
    UE_LOG(LogTemp, Warning, TEXT("Spawned metahuman"));
    
}