I'm not very experienced with scripting but was hoping to be able to find out what mesh selection mode (edges,faces or verts) Blender is in while in edit mode to make some custom hotkey assignments that takes this into account.

I have worked out how to set up a basic modal operator so need something to feed into an if statement.



2 Answers 2


You can access this via the Scene property:

Or if you're editing meshes using the BMesh API (if you're modifying the mesh in BMesh already).

Example to run in the console:

>>> print(bpy.context.scene.tool_settings.mesh_select_mode)
<bpy_boolean[3], ToolSettings.mesh_select_mode>

To see the values, you can get get the sequence as a tuple

>>> print(tuple(bpy.context.scene.tool_settings.mesh_select_mode))
(True, False, False)

It took a newbie like me a little bit to figure out the if statement: hope this helps.

    def invoke(self, context, event):
        if tuple(bpy.context.scene.tool_settings.mesh_select_mode) == (True, False, False):
        return {'FINISHED'}

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.