bpy.data and bpy.context is only used inside the registered function