How to get key config list in Blender Python
This is a part of the project “Easy Keymap Generator”.
GOAL
To get the key config list in my addon. The list of key configs can be seen in Preferences window.
![](https://s-nako.work/wp/wp-content/uploads/2021/02/image-31.png)
Environment
Blender 2.83 (Python 3.7.4)
Windows 10
Method
Get the list directly from the preset directories.
Related article: How to get preset paths in Blender Python
def get_keyconfigs(): """ :return: dict{kerconfig_name(str): path to config file(str)} """ config_pathes = bpy.utils.preset_paths("keyconfig") config_dict = {} for config_path in config_pathes: for file in os.listdir(config_path): name, ext = os.path.splitext(file) if ext.lower() in [".py", ".xml"] and not name[0] == ".": config_dict[name] = os.path.join(config_path, file) return config_dict print(key_config_dict.keys()) #output => dict_keys(['blender', 'blender_27x', 'industry_compatible', 'test1', 'test2'])