Converting a script to an addon in 2.8 Hi so with some help i was able to get a pie menu script that does what i want when i run it. how would i set it up so i can run it in 2.8 with a hotkey? thanks for any help

import bpy
from bpy.types import Menu, Operator

# spawn an edit mode selection pie (run while object is in edit mode to get a valid output)



class AntiBevel(Operator):
    bl_idname = "anti.bevel"
    bl_label = "AntiBevel"

    def execute(self, context):
        bpy.ops.object.shade_flat()
        bpy.ops.object.modifier_remove(modifier="Bevel")
        bpy.ops.object.editmode_toggle()
        bpy.ops.mesh.select_all(action='SELECT')
        bpy.ops.mesh.mark_sharp(clear=True)
        bpy.ops.transform.edge_bevelweight(value=-1)
        bpy.ops.object.editmode_toggle()
        return {'FINISHED'}

class HyperBevel(Operator):
    bl_idname = "hyper.bevel"
    bl_label = "HyperBevel"

    def execute(self, context):
        bpy.ops.object.editmode_toggle()
        bpy.ops.mesh.select_mode(use_extend=False,use_expand=False, type='EDGE')
        bpy.ops.mesh.select_all(action='SELECT')
        bpy.ops.mesh.mark_sharp(clear=True)
        bpy.ops.transform.edge_bevelweight(value=-1)
        bpy.ops.object.editmode_toggle()
        bpy.ops.object.transform_apply(scale=True)
        bpy.ops.object.shade_smooth()
        bpy.ops.object.modifier_remove(modifier="Bevel")
        bpy.ops.object.modifier_add(type='BEVEL')
        bpy.context.object.modifiers["Bevel"].limit_method = 'WEIGHT'
        bpy.context.object.modifiers["Bevel"].segments = 3
        bpy.ops.object.editmode_toggle()
        bpy.ops.mesh.select_all(action='DESELECT')
        bpy.ops.mesh.edges_select_sharp()
        bpy.ops.mesh.mark_sharp()
        bpy.ops.transform.edge_bevelweight(value=1)
        bpy.ops.object.editmode_toggle()
        bpy.context.object.data.use_auto_smooth = True
        bpy.context.object.modifiers["Bevel"].width = 0.02
        bpy.context.object.modifiers["Bevel"].use_clamp_overlap = False
        bpy.ops.object.modifier_move_up(modifier="Bevel")
        return {'FINISHED'}

class VIEW3D_PIE_template(Menu):
    # label is displayed at the center of the pie menu.
    bl_label = "Operators"

    def draw(self, context):
        layout = self.layout

        pie = layout.menu_pie()
        pie.operator("hyper.bevel")
        pie.operator("anti.bevel")


def register():
    bpy.utils.register_class(VIEW3D_PIE_template)
    bpy.utils.register_class(HyperBevel)
    bpy.utils.register_class(AntiBevel)


def unregister():
    bpy.utils.unregister_class(VIEW3D_PIE_template)
    bpy.utils.unregister_class(HyperBevel)
    bpy.utils.unregister_class(AntiBevel)


if __name__ == "__main__":
    register()

    bpy.ops.wm.call_menu_pie(name="VIEW3D_PIE_template")
To assign a hotkey you do not have to code :)


Go to Edit > Preferences > Keymap
Assuming you want to trigger the hotkey in edit mode, find 3D View > Mesh > Mesh (Global)





Scroll down until you find  + Add New  button. Click it and you should get





Expand and replace none in the identifier field with your operator id and assign the keyboard/mouse shortcut. 





Go to edit mode and test!!