Use PlayerController’s function ConsoleCommand() APlayerController::ConsoleCommand | Unreal Engine Documentation
ConsoleCommand()