Python addon doesn't update when changing values

I’m a computer scientist myself and i’m learning blender API and Python, i’m mixing a bunch of tutorials, examples and other things i found along the web and i’m experimenting a couple of codes in blender python language.

My first addon was a operator in a simple panel, i ‘wrote’ the code using a template i found online, but i kinda was able to understand the things.The moment i changed the value, the mesh updates itself.

It works great, so i move on to a new challenge, make that fancy pop-up operators, i got some examples and i was able to achieve this :

import bpy

class DialogOperator(bpy.types.Operator):
    bl_idname = "mesh.dialog_operator"
    bl_label = "test"
    bl_options = {'REGISTER', 'UNDO'}

    distance = bpy.props.FloatProperty(
    name="Distance",
    default=0.02,
    precision=3,
    description="distance"
    )


    depth = bpy.props.FloatProperty(
        name = "Depth",
        description = "Depth",
        precision=3,
        default = 0.00
        )

    def execute(self, context):
        bpy.ops.mesh.inset(use_boundary=True, use_even_offset=True, use_relative_offset=False, use_edge_rail=False, thickness=self.distance, depth=self.depth, use_outset=False, use_select_inset=False, use_individual=False, use_interpolate=True)   
        return {'FINISHED'}

    def invoke(self, context, event):
        wm = context.window_manager
        return wm.invoke_props_dialog(self)


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

if __name__ == "__main__":

 register()

That works and showed up the Pop-up i was looking for, however by the time i change the values, the mesh itself doesn’t update realtime like it did with simple panel method above, only when i press"OK", the window closes, the inset is executed and it shows on the mesh.

https://i.stack.imgur.com/TR8uY.png

And after it, for somehow it also appears on the side as a ordinary panel.

https://i.stack.imgur.com/1RDVw.png

I believe it could be easy mistakes, but i want to understand what i’m really doing in here, i read some stuff, but doesn’t mean anything yet, is like a couple jigsaw pieces that i’m putting together.

Thank you in advance

Add this in between execute and invoke operator:

def check(self, context): 
      return True

Thank you for the help, but it didn’t work. Here’s the code

EDIT: I fixed the code

import bpy

class DialogOperator(bpy.types.Operator):
    bl_idname = "mesh.dialog_operator"
    bl_label = "test_2"
    bl_options = {'REGISTER', 'UNDO'}


    distance = bpy.props.FloatProperty(
    name="Distance",
    default=0.02,
    precision=3,
    description="distance"
    )




    depth = bpy.props.FloatProperty(
        name = "Depth",
        description = "Depth",
        precision=3,
        default = 0.00
        )


    def execute(self, context):
        bpy.ops.mesh.inset(use_boundary=True, use_even_offset=True, use_relative_offset=False, use_edge_rail=False, thickness=self.distance, depth=self.depth, use_outset=False, use_select_inset=False, use_individual=False, use_interpolate=True)   
        return {'FINISHED'}
    
    def check(self, context): 
      return True


    def invoke(self, context, event):
        wm = context.window_manager
        return wm.invoke_props_popup(self,event)




def register():
 bpy.utils.register_class(DialogOperator)
 
def unregister():
 bpy.utils.unregister_module(DialogOperator)


if __name__ == "__main__":


 register()

Now works like a charm, but it doensn’t run “execute” when it opens, only when i change a value. Is there anyway to make it do that?

Try this:

import bpy
class DialogOperator(bpy.types.Operator):
    bl_idname = "mesh.dialog_operator"
    bl_label = "test_2"
    bl_options = {'REGISTER', 'UNDO'}

    distance = bpy.props.FloatProperty(
    name="Distance",
    default=0.02,
    precision=3,
    description="distance"
    )


    depth = bpy.props.FloatProperty(
        name = "Depth",
        description = "Depth",
        precision=3,
        default = 0.00
        )

    def execute(self, context):
        bpy.ops.mesh.inset(use_boundary=True, use_even_offset=True, use_relative_offset=False, use_edge_rail=False, thickness=self.distance, depth=self.depth, use_outset=False, use_select_inset=False, use_individual=False, use_interpolate=True)   
        return {'FINISHED'}
    
    def check(self, context): 
        return True

    def invoke(self, context, event):
        wm = context.window_manager
        bpy.ops.mesh.inset(use_boundary=True, use_even_offset=True, use_relative_offset=False, use_edge_rail=False, thickness=self.distance, depth=self.depth, use_outset=False, use_select_inset=False, use_individual=False, use_interpolate=True)   
        return wm.invoke_props_popup(self,event)


def register():
 bpy.utils.register_class(DialogOperator)
 
def unregister():
 bpy.utils.unregister_module(DialogOperator)

if __name__ == "__main__":

 register()

Thank you for the help, works great now.

is this check func method a new added feature for class in API ?

what does it do ?

how does it compare to scene update or other update ?
by the way how do you make last script to work ?

how to get the pop up window ?

thanks
happy bl