Creating World/Level by C++

Hi,

I’m trying to create a new level by C++ code. I found, that I can use

auto World = UWorld::CreateNewWorld();
FEditorFileUtils::SaveMap(World, TEXT("World'/Game/Map.Map'"));

But there I need to use UnrealEd module with which I have some problems. After adding it to Build.cs file project doesn’t compile. I have found information about creating new Editor Module, but I want to use this functionality by pressing a single button. For example, I have defined bool bCreateWorld in my class, and in OnConstruction I want to use it like that:

if (bCreateWorld) {
 bCreateWorld = false;
 auto World = UWorld::CreateNewWorld();
 FEditorFileUtils::SaveMap(World, TEXT("World'/Game/Map.Map'"));
}

Is it possible?