Python - Blender/Maya to UE4 using Remote Execution

Poking around the “” file I was able to create this rough test. The test basically returns an array of ue4 asset paths from ue4 back to the application running python.

To run the test you need to first, enable the python scripting plugin and turn on “Enable Remote Execution” under “Project settings” => Plugins => Python =>Python Remote Execution

Then in UE4, select a few assets in the asset browser and then run the below code in the python script editor in blender, maya, or whatever python terminal you got.

There are a lot of possibilities here!!

…Also I am looking forward to the release of “Blender - Send to UE4”

import sys
sys.path.append(r'C:\Program Files\Epic Games\UE_4.24\Engine\Plugins\Experimental\PythonScriptPlugin\Content\Python')
import remote_execution as remote

def executeCommand(command):
    remote_exec = remote.RemoteExecution()
    exec_mode = 'EvaluateStatement'
    rec = remote_exec.run_command(command, exec_mode=exec_mode)
    if rec'success'] == True:
        return rec'result']
    return None

#Based on the selected assets in the ue4 asset browser, return an array with asset paths
#'StaticMesh"/Game/art/Meshes/ST_gourd01.ST_gourd01"', 'StaticMesh"/Game/art/Meshes/ST_gourd02.ST_gourd02"']
def getSelectedAssetPaths():
    assetPaths = ]
    command = "str(unreal.GlobalEditorUtilityBase.get_default_object().get_selected_assets())"
    result = executeCommand(command)
    if result != None:
        string = result[2:-2]
        for e in string.split():
            path =  e.replace("\\'","").replace(",","")
    return assetPaths



Thank you for this example.
I integrated and modified your example to pass various commands to Unreal Editor from Maya. It worked very well for a while but now seems to be broken, and I’m getting the error:

RuntimeError: Remote party failed to attempt the command socket connection!

I double-checked and Enable Remote Execution is turned on in my project settings. I also checked that the socket id numbers were the same in the project settings as they are in the If you have any insights I’d be very grateful.

It’s been months since the last time I was testing this but I haven’t changed anything.

Very useful I’m using this remote_execution all the time now thank you !