Unreal Engine Python plugin

I’ve been trying to integrate the Unreal Engine Python plugin into our custom 4.16 build, but having a bit of trouble. After a bit of faffing about, I’m able to build the plugin from source, no errors or warnings. However, UE4 crashes on startup when it tries to load the UEPython plugin. I’ve been bashing away at this for the better part of the afternoon with no joy. To make things worse, the crash logs don’t capture anything useful (last output is before it even gets to UEPython).

Does anyone who has successfully integrated UEPython have any ideas? Clutching at straws here :stuck_out_tongue:

Hi, ensure you have a 64bit python installation and that its directory is in the system PATH. Eventually download an embedded distribution from python.org and copy it into Plugins/UnrealEnginePython/Binaries/Win64. More important, always build the plugin with the editor closed otherwise an hotreload-version could be built

A Python Plug in? Dang flam it I’m glad I found this I’m going to give it a try.

Hi Roberto, thanks for the suggestions. I’d already ensured most of the stuff prior (64-bit python, system path, editor closed, etc). Adding the embedded python to the plugin binaries folder did the trick, though! I’ve now got UEPy up and running, and it’s fantastic. I’d done some very minimal pipeline automation prior to this (mainly just setting texture formats based on naming convention), but generally steered clear just due to the inconvenience and terror of having to modify engine/editor code in C++ (and having to compile!). Coming from a Unity background, UEPy should make me feel a fair bit more empowered again, so thanks!

Followup questions:

  1. If I’m using PyCharm as my IDE (instead of the UEPy editor window), where do I find the modules to be imported so I can get intellisense (eg the unreal_engine module)?
  2. This might be a dumb question, but I’ve never used embedded python before. How would I go about adding importable modules if using the embedded python (since that seems to be the only way I can get UEPy to work on our setup)?
  3. I seem to be unable to properly import modules from the Scripts folder. The import statement goes off without a hitch, but I can’t actually access any of the functions defined within.

LogPython:Error: module 'CreateMaterialInstance' has no attribute 'TestFunc'
LogPython:Error: Traceback (most recent call last):
LogPython:Error:   File "<string>", line 20, in <module>
LogPython:Error: AttributeError: module 'CreateMaterialInstance' has no attribute 'TestFunc'

3a. I ran across this because I’d like to group context menu items together, either by broad category, or under the company/project name, but after closing a section when registering, I’m unable to add on to that section (passing the same name just creates a brand new section with the same name). In order to get around this I was planning to have a single script to handle registering all the context menu entries, by importing the relevant modules and calling the relevant functions.