Trouble disabling default keys in addon.

I’m trying to disable some Blender default keys which are conflicting with other keys I’m working on in an addon. This code works fine when run from the text editor, but does not work from startup. The addon works fine when run from the text editor however, and all together everything works from startup except for being able to disable these keys. I noticed in the Console (when observing the addon from startup) that the code cuts out at the “for key in keys:” line. Could I be conflicting terms?

Anyone know a reason why this won’t work on startup? Do I need to be updating the window manager or scene data in some way? Ultimately I could overwrite these keys by adding my custom keys into each individual category, but that sucks. Thanks.

    keys = wm.keyconfigs.default.keymaps['3D View'].keymap_items
    for key in keys:
        if key.type == 'ACCENT_GRAVE':
            key.active = False


    keys = wm.keyconfigs.default.keymaps['Object Mode'].keymap_items
    for key in keys:
        if key.type == 'X':
            key.active = False


    keys = wm.keyconfigs.default.keymaps['Mesh'].keymap_items
    for key in keys:
        if key.type == 'X':
            key.active = False