Various fixes to get import working regardless of Blender's Context.