To answer your first question:
UE4Editor.exe is the editor itself. UE4Editor-Cmd.exe is the command-line for the editor. I’m actually really surprised to hear that UE4Editor-Cmd.exe is opening up the GUI for you. I’ve had it open “live coding” before, but that’s about it.
- I’m not sure about how to do this in Python, but here’s a way of doing it in C#, maybe you can figure it out how to convert that to Python.
Process myProcess = new Process();
Process myProcess = new Process();
myProcess .StartInfo.FileName = UE4EditorCmd; //Relative path to UE4Editor.exe
myProcess .StartInfo.Arguments = "myProject.uproject -run=pythonscript"
myProcess .ErrorDataReceived += MyErrorFunc;
myProcess .OutputDataReceived += MyOutputFunc;
myProcess .Start();
myProcess.BeginErrorReadLine();
myProcess.BeginOutputReadLine();
try
{
if (myProcess.WaitForExit(maxTime))
{
//test for different results. A result of 1, 2 or 3 doesn't mean it failed.
//A result with a negative number means it crashed.
}
internal static void MyErrorFunc(object _sender, DataReceivedEventArgs _event)
{
Console.WriteLine(_event.Data);
}
//Same idea for MyOutputFunc