How to have a script run from a keypress? I'm trying to get keymaps working in my script, but it's not working.  I want grid size of the current view3D to double if I press Ctrl-LeftArrow and halve if I press Ctrl-RightArrow.  Right now I'm just trying to print debug messages in response to keypresses.
Below is my code, but my operator is not being called no matter what key map items I add.  Am I doing this correctly?
import bpy


class GridRescale(bpy.types.Operator):
    &quot;&quot;&quot;Change grid scale&quot;&quot;&quot;
    bl_idname = &quot;kitfox.grid_rescale&quot;
    bl_label = &quot;Grid Rescale&quot;
    bl_options = {'REGISTER'}

    def invoke(self, context, event):
        print(&quot;evt type %s&quot; % (event.type))

    def execute(self, context):
        scale = bpy.context.space_data.overlay.grid_scale

        print(&quot;execute&quot;)
        self.report({'INFO'}, &quot;Grid scale %f&quot; % (scale))

        return {'FINISHED'}


# store keymaps here to access after registration
addon_keymaps = []


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

    # handle the keymap
    wm = bpy.context.window_manager
    km = wm.keyconfigs.addon.keymaps.new(name='Object Mode', space_type='EMPTY')
#    kmi = km.keymap_items.new(GridRescale.bl_idname, 'NUMPAD_0', 'PRESS', ctrl=False, shift=False)
    kmi = km.keymap_items.new(GridRescale.bl_idname, 'LEFT_ARROW', 'PRESS', ctrl=True, shift=False)
    addon_keymaps.append(km)

#    kmi = km.keymap_items.new(GridRescale.bl_idname, 'NUMPAD_0', 'PRESS', ctrl=False, shift=False)
    kmi = km.keymap_items.new(GridRescale.bl_idname, 'RIGHT_ARROW', 'PRESS', ctrl=True, shift=False)
    addon_keymaps.append(km)
    

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

    # handle the keymap
    wm = bpy.context.window_manager
    for km in addon_keymaps:
        wm.keyconfigs.addon.keymaps.remove(km)
    # clear the list
    del addon_keymaps[:]


if __name__ == &quot;__main__&quot;:
    register()
```
Return a status set from invoke.
AFAICT the issue here is as simple runtime error, not returning a valid status set from an operators invoke method.  No return, returns None.
Pretty obvious from error message printed to system console on testing a keypress.
evt type RIGHT_ARROW
Python: RuntimeError: class KITFOX_OT_grid_rescale, 
function invoke: incompatible return value , , 
Function.result expected a set, not a NoneType

Possible suggestion.
def invoke(self, context, event):
    print(&quot;evt type %s&quot; % (event.type))
    return self.execute(context)

PS in a method where context is passed, common in operators and panels, there is never a need to see bpy.context