When you press "Ok" you are calling the execute method of the operator, in which you are re-calling your operator. Get rid of bpy.ops.wm.myop('INVOKE_DEFAULT') in the execute method.
Blender 2.8 uses annotations for properties.
Blender 2.8 uses strict naming conventions for operator and panel class names. For the operator with id wm.myop the class needs to be named WM_OT_myop. Please check the system console for errors.

Test script. Added to text menu of text menu for example sake./
import bpy
class WM_OT_myop(bpy.types.Operator):
"""Tooltip"""
bl_idname = "wm.myop"
bl_label = "Simple Object Operator"
# annotations in 2.8
name : bpy.props.StringProperty(name="Name", default="")
@classmethod
def poll(cls, context):
return context.active_object is not None
def execute(self, context):
return {'FINISHED'}
def invoke(self, context, event):
wm = context.window_manager
return wm.invoke_props_dialog(self)
def menu_draw(self, context):
self.layout.operator("wm.myop")
def register():
bpy.utils.register_class(WM_OT_myop)
bpy.types.TEXT_MT_text.append(menu_draw)
def unregister():
bpy.utils.unregister_class(WM_OT_myop)
if __name__ == "__main__":
register()
# test call
bpy.ops.wm.myop('INVOKE_DEFAULT')
In order to make the operator work as part of a 'floating menu' you have to set the operator_context property of the layout beforehand, which basically allows to display the popup:
import bpy
class WM_OT_myop(bpy.types.Operator):
"""Tooltip"""
bl_idname = "wm.myop"
bl_label = "Simple Object Operator"
name: bpy.props.StringProperty(name="Name", default="")
@classmethod
def poll(cls, context):
return context.active_object is not None
def execute(self, context):
return {'FINISHED'}
def invoke(self, context, event):
wm = context.window_manager
return wm.invoke_props_dialog(self)
class Custom_MT_Menu(bpy.types.Menu):
bl_label = "Custom Menu"
bl_idname = "OBJECT_MT_custom_menu"
def draw(self, context):
layout = self.layout
layout.operator("wm.save_as_mainfile").copy = True
layout.operator_context = 'INVOKE_DEFAULT'
layout.operator("wm.myop")
def register():
bpy.utils.register_class(Custom_MT_Menu)
bpy.utils.register_class(WM_OT_myop)
def unregister():
bpy.utils.unregister_class(Custom_MT_Menu)
bpy.utils.unregister_class(WM_OT_myop)
if __name__ == "__main__":
register()
# The menu can also be called from scripts
bpy.ops.wm.call_menu(name=Custom_MT_Menu.bl_idname)
Further reading: How to call a confirmation dialog box?
layout.operator("wm.myop",text="Save")and that is my issue. You are able to call the op from themainwithbpy.opswhich naturally works and that is why I stuck thatbpy.opsinside the operator itself. I hope it makes sense. Basically when I call from a menu vialayout.operatorI cant make it to trigger the pop up. – yarun can Feb 18 '19 at 17:56