Python Command Line
Tips for the Python Command Line in Unreal
Last updated
Tips for the Python Command Line in Unreal
Last updated
When developing Unreal Python tools I regularly using the Python input on the Output Log Window:
We don't always need to relaunch Unreal to try out a few changes to a module's logic, in the Output Log window we can run importlib.reload:
This will even reload Blueprint Function libraries, although caution is advised to make sure you're updating the BP Graph / any downstream dependencies for your code development.
If you find yourself constantly using the same modules in the Output Log's Python command line, we can make them available by default in one of two ways.
The first method is to add our imports to the Project Setting's Python section, anything in there will be accessible from the Python command line in the Editor:
Another method is with an init_unreal.py file, any imports, classes, or functions declared in one of these files will also be added to the main namespaces accessible from the Python command line in the Editor:
Both options will load these modules/functions for us, making them accessible right away in the Python command line: