Access a property in python from a menu I tried to answer a question on blenderartists from what I already know, and then it was pointed out to me that I should be able to use the property directly in the panel menu instead of creating the operator for it outside the menu like I did here:

import bpy


class AutoMergeBool(bpy.types.Operator):
    """Automerge Toggle"""
    bl_idname = "mesh.automerge_toggle"
    bl_label = "Automerge Toggle Operator"

    @classmethod
    def poll(cls, context):
        return context.active_object is not None

    def execute(self, context):
        #main(context)
        merge = bpy.context.scene.tool_settings


        if merge.use_mesh_automerge != True:
            merge.use_mesh_automerge = True
        else:
            merge.use_mesh_automerge = False
        return {'FINISHED'}

class CustomMenu(bpy.types.Menu):
    bl_label = "Custom Menu"
    bl_idname = "view3D.custom_menu"


    def draw(self, context):

        self.layout.operator("mesh.automerge_toggle")
        self.layout.operator("mesh.primitive_cube_add")

def register():
    bpy.utils.register_class(CustomMenu)
    bpy.utils.register_class(AutoMergeBool)
    bpy.ops.wm.call_menu(name=CustomMenu.bl_idname)

def unregister():
    bpy.utils.unregister_class(CustomMenu)
    bpy.utils.unregister_class(AutoMergeBool)

if __name__ == "__main__":
    register()


Can anyone give me a single line example of how the property should be accessed in the layout so that it results in the bool? I already tried searching here and elsewhere and haven't found anything that works.
Instead of adding a layout.operator you would add a layout.prop, which would look like this:

self.layout.prop(context.scene.tool_settings, "use_mesh_automerge")


The first parameter in the parentheses is where the property is stored and the second is the name of the property you wish to access.

This results in this menu, with a property that can be toggled on and off: