1
$\begingroup$

I have an addon with a modal operator, I change the file (Operator) which is in the Blender scripts directory (Windows AppData path) in an external editor.

Then I use reload scripts to reload the addon. The init.py file is updated, I can also see the new version in the preferences if I change it, but the operator is not updated.

To update the operator I have to restart Blender. The operator is unregister in the unregister method:

def register():
    bpy.utils.register_class(DP_OT_draw_operator)

def unregister():  
    bpy.utils.unregister_class(DP_OT_draw_operator)

It is derived from another class which extends Operator:

class DP_OT_draw_operator(BL_UI_OT_draw_operator):

    bl_idname = "object.dp_ot_draw_operator"
    bl_options = {'REGISTER' }

    def __init__(self):

        super().__init__()

        self.panel = BL_UI_Drag_Panel(100, 400, 300, 200)
        self.panel.bg_color = (0.2, 0.2, 0.2, 0.9)

Could this be a problem or that the Operator is a modal one?

$\endgroup$
  • $\begingroup$ A modal runs as long as the user interrupts its execution so I don't get why you have to reload something...? Also I don't get how this code is related to your question. First thing I'd try is running the code from one main file... probably obvious. $\endgroup$ – brockmann Mar 28 '19 at 9:42
  • $\begingroup$ Related blender.stackexchange.com/questions/112028/… $\endgroup$ – batFINGER Mar 28 '19 at 11:58
  • $\begingroup$ @brockmann : I am reloading because I am developing and changing the addon code - so I need to reload cause I am using an external editor. $\endgroup$ – Jayanam Mar 28 '19 at 14:36
  • $\begingroup$ @batFINGER : Ok, I can derive like this but it doesnt solve the reload problem. The operator is just not reloaded when I change the file in an external editor $\endgroup$ – Jayanam Mar 28 '19 at 14:49
  • $\begingroup$ @Jayanam Upvoted. However, it's hard to guess without having your environment. $\endgroup$ – brockmann Apr 1 '19 at 8:58

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.