Edit 3:
The above workaround is unstable (occasionally crashes Blender) unless Load UI is disabled.
So, add this line before calling bpy.ops.wm.read_homefile()
:
bpy.context.user_preferences.filepaths.use_load_ui = False
That, of course, kind of kills the purpose of reloading startup file, unfortunately.
Oh, and the same issues appear when calling read_factory_settings()
.
When I run the screen_full_area() stuff from load_handler
then it does not crash, however, in the "main" code the bpy.context.area
is still None
- and when I do screen_full_area() stuff there too, it crashes again.
I suspect that crashing is due to some code in screen_full_area(), not the context changing, so we are back to the question is there a way to set the context directly?