Importing external librarys like PySide

Hello,

I have seen on this blog that it is possible to integrate and use external library like PySide.
I installed the PySide Library on my “Windows Python” but it is still not recognized by the “Unreal Python” (in my normal Python commandline it is installed and usable).
Is there a special way to integrate PySide (or any other library) into the “Unreal Python”?

Thanks in advance for your help and time!

You probably just need to add the path to the module into your Unreal Python’s sys.path variable.

I typed this in the Unreal Output Log python console:


sys.path.append("D:/apps/Python27/Lib/site-packages")

then it’s able to resolve the path when I use


from PySide import QtGui


If you look at the Python Paths section of the doc it describes some different ways to add the paths.

And you saved me again! Thank you. I never mentioned the option to put in own paths.

PYTHONPATH is used by the python interpreter to determine which modules to load.

PATH is used by the shell to determine which executables to run.

This is actually very interesting to me as a long-time Qt developer - does running a PySide application work correctly in UE? Usually combining C++ Qt with something like Unreal means doing manual work integrating the event loop and determining who gets input events etc. Would be pretty cool if it somehow just works going through python :open_mouth: (or maybe the UE UI is blocked while running python so its easy, the Qt app then has total control until its quit?)

I admit I have not looked much into the UE Python support but its something I will doing very soon.

Hi, I have a problem in importing some libraries such as numpy, I added path but it doesn’t work