Bug? SystemLibrary.execute_console_command not really working

Good morning!

Sadly, I don’t know if it’s a bug, but the function ExecuteConsoleCommand is not made to work outside of Play Mode. (Which is sad)
The reason it does not work: The function passes through the Player Controller to execute the command.
In my opinion, the function should not be available in Python, but Python has everything that Blueprint has, so this is why we see it.

I tried to find a Python workaround, but I was not able.

Here is a C++ function that does exactly what you need:

https://answers.unrealengine.com/que…on-script.html



void UCppLib::ExecuteConsoleCommandEditor(FString Cmd) {
    if (GEditor) {
        UWorld* World = GEditor->GetEditorWorldContext().World();
        if (World) {
            GEditor->Exec(World, *Cmd, *GLog);
        }
    }
}