How can I modify the Default Blender Keymap within my Add-on module registration code?
I had similar problems when tried to modify default key maps with python.
The keymap_items collection was empty at startup script but after the start, items were accessible.

The problem was solved using thread and time.sleep
It is not the best approach but working..

The load_post handler didn't work for application start but worked for file open.

I didn't find any "start_post" handler method.

here is the first code (startup scripts folder):

import bpy

wm = bpy.context.window_manager
kc = wm.keyconfigs.default
km = kc.keymaps['Screen Editing']
print('item count:',len(km.keymap_items))

#&gt; "item count: 0"


here is the solved version

import bpy,_thread,time


wm = bpy.context.window_manager
kc = wm.keyconfigs.default
km = kc.keymaps['Screen Editing']


def thrd_func():
    time.sleep(.1)
    print('item count:',len(km.keymap_items))

_thread.start_new_thread(thrd_func,())


#&gt; "item count: 12"


and with handler

import bpy
from bpy.app.handlers import persistent

@persistent
def hand_func(arg):
    wm = bpy.context.window_manager
    kc = wm.keyconfigs.default
    km = kc.keymaps['Screen Editing']
    print('item count:',len(km.keymap_items))

bpy.app.handlers.load_post.append(hand_func)