Editor widget python node fails when you leave the editor widget onscreen and close/restart editor?!

Has anyone else seen this and/or know how to fix it?

My script is barebones. It’s an editor utility widget that has one button that fires a custom python node in it that just prints hello.

That all works. <and yes, the script is added as a “startup script” and is in a directory that’s added to the python “additional paths” option>

The issue is that if i leave that widget window open when i close/restart unreal, it corrupts the python node. To fix that, you basically have to close the widget window and close/restart unreal again, then open the widget window. This obviously sucks, so I’d like to know what I’m doing wrong?

I took a quick look at this issue and found a couple things

  • The editor is restoring windows/tabs before the python module executes its startup scripts
  • The python module executes its startup script in the first TICK, whereas it appears that this would not be a problem if the startup scripts were executed during FPythonScriptPlugin.InitializePython, as this comes before the windows are restored.

Why does the python plugin defer **startup **scripts to the first tick? They aren’t startup scripts any more when it does that, they are runonce scripts, and those are useless for being able to depend on for blueprint function libraries that may be utilized by editor utility scripts.

This seems to me like a pretty fundamental design failure not to ensure the python blueprint functions are usable in the most basic form of editor scripting(editor utility scripts)

I copied the PythonScriptPlugin from the engine folder to project, and moved the startup script execution to the bottom of FPythonScriptPlugin.InitializePython, so it executes the startup scripts during the actual startup, and the busted editor utility script issue was fixed. I don’t know if there is some other issue that deferring that functionality to the tick was meant to fix, but the way it ships is inadequate to depend on for these types of tool blueprints.