Page MenuHome

Addon's keymaps are not registered at Blender opening if the addon's enable state is saved in user preferences
Closed, InvalidPublicBUG


Blender Version
Broken: 2.80

Short description of error

The code bellow illustrates the issue, it register a new shortcut (here for example the translate operator on numpad asterix key). When the addon is activated for the first time, then the shortcut works correctly. If this activation state is saved in user preferences and then Blender reopenned, the shortcut does not works anymore.

bl_info = {
	'name': 'Test',
	'blender': (2, 80, 0),
	'category': '3D View'

import bpy

def register():
	wm = bpy.context.window_manager
	kc =
	km = kc.keymaps['3D View']
	kmi ='transform.translate', type='NUMPAD_ASTERIX', value='PRESS')

def unregister():
	wm = bpy.context.window_manager
	km =['3D View']
	kmi = km.keymap_items.remove(km.keymap_items['transform.translate'])

if __name__ == "__main__":

Event Timeline

I have the same issue, the keymaps are not persisted.

Germano Cavalcante (mano-wii) changed the task status from Needs Triage to Confirmed.Mar 27 2020, 2:36 PM
Germano Cavalcante (mano-wii) changed the subtype of this task from "Report" to "Bug".

You need to use wm.keyconfigs.addon for this to work as expected.