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$
5
  • $\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
    Commented Mar 28, 2019 at 9:42
  • $\begingroup$ Related blender.stackexchange.com/questions/112028/… $\endgroup$
    – batFINGER
    Commented Mar 28, 2019 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
    Commented Mar 28, 2019 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
    Commented Mar 28, 2019 at 14:49
  • $\begingroup$ @Jayanam Upvoted. However, it's hard to guess without having your environment. $\endgroup$
    – brockmann
    Commented Apr 1, 2019 at 8:58

0

You must log in to answer this question.

Browse other questions tagged .