Is there a way to control an actor inside Unreal Engine externally using a Python script?

I want to move a vehicle inside UE, via an external Python script. The idea is - I have a Python script that identifies my keystrokes and then will use those keys to trigger the input event/axis inside UE to move the vehicle.

The communication will happen between Python and UE via UDP.

Looking for kind help and is greatly appreciated.

Thank you!

Can someone help me please. Thank you.

There’s not any way to directly connect a Python script to a packaged Unreal setup. You could use some kind of IPC (interprocess communication) or network connection, to transmit data, though.

The project I work on uses a nodejs based server, which both Unreal (as a renderer, and we also support Unity and a in-house renderer option) and various input softwares connect to. The user input software tells the server what it wants the renderer to do, and then the server tells Unreal/Unity/in-house renderer what the user asked for.

1 Like

Dear eblade,

Thank you for your kind reply.

If I understand it correctly, I would need a IPC or a server of some kind that will take input from keyboard and transfer that to actor/character/vehicle inside Unreal, isn’t it? So this won’t directly happen via UDP packets alone I guess.

This leads me to figure out about the Server / IPC then!