Download

Executing Python with Web Remote Control

Hi all!

I’m attempting to create a remote instance of Unreal that will be able to able to use HighResScreenshot (or Pythons equivalent command) or render sequences. I’ve tried running a Python server directly in Unreal and while seems to be able to run the server it crashes the the rest of Unreal (even if I use multithreading to put the server in it’s own thread). Now I’m trying to achieve this through the Web Remote Control plugin. I can get this running no problem but can’t wrap my head around the the documentation for executing Python.

It says:

And then in the API HTTP reference it says:

Anyone smarter than me able to help me parse this or provide guidance on how they’d tackle setting up a system that can take remote renders on an EC2 instance.

Thanks!

1 Like

Hello Alex!

Having a Python file \Project\Content\Python\remote.py:

import unreal

@unreal.uclass()
class RemoteClass(unreal.BlueprintFunctionLibrary):
    
    @unreal.ufunction(static=True)
    def remote():
        print("Hello from remote!")

You can send PUT request with a body:

{
	"objectPath": "/Engine/PythonTypes.Default__RemoteClass",
	"functionName": "remote"
}

After “installing” the class into the Engine by entering command: py remote.py (in Output window). The result is text “Hello from remote!” logged into Output window.

2 Likes

Hey Fidilip, thanks for the input on this one!

I implemented this code for a basic functions test, and hit a few snags that could prove useful to others coming after us, so I decided to stop lurking and starting throwing out observations.

Your code answered an important question for what the Python is supposed to look like, but my super new self couldn’t figure out what sort of http request to make (aside from a PUT request).

You’re going to want to run it like this, assuming you’re using default ports:
http://localhost:30010/remote/object/call

This, along with the JSON payload described above should have you up and running in no time. After that, you’ll need to figure out how to capture renders and ship them off for consumption elsewhere.