Blender Pie Menu help
The way i was dealing with input was not correct i needed to use the more advanced invoke and modal options to get the desired results.
https://docs.blender.org/api/2.90/bpy.types.Operator.html?highlight=operator#module-bpy.types.Operator
Here is the updated code:
import bpy

class PS_Remesh(bpy.types.Operator):
    bl_idname = &quot;ps.remesh&quot;
    bl_label = &quot;Remesh&quot;

    def execute(self, context):
        if context.active_object is None:
            print(&quot;Active object == none: Cancel&quot;)
            return {'CANCELLED'}
        else:
            bpy.ops.object.voxel_remesh()
            return {'FINISHED'}

class PS_MaskBrush(bpy.types.Operator):
    bl_idname = &quot;ps.mask_brush&quot; #use this as the pie.operator(&quot;ps.remesh&quot;) to use in pie menu
    bl_label = &quot;Mask Brush&quot;
    
    def execute(self, context):
        if context.active_object is None:
            print(&quot;Active object == none: Cancel&quot;)
            return {'CANCELLED'}
        elif context.mode == 'SCULPT':
            print(&quot;In sculpt mode sculpt mode select mask brush&quot;)
            bpy.ops.wm.tool_set_by_id(name=&quot;builtin_brush.Mask&quot;,space_type=&quot;VIEW_3D&quot;)
            return {'FINISHED'}
        elif context.mode != 'SCULPT':
            print(&quot;Not in sculpt mode sculpt mode activate&quot;)
            bpy.ops.object.mode_set(mode='SCULPT')
            bpy.ops.wm.tool_set_by_id(name=&quot;builtin_brush.Mask&quot;, space_type=&quot;VIEW_3D&quot;)
            return {'FINISHED'}

class VIEW3D_MT_pie_sculpt(bpy.types.Menu):
    # label is displayed at the center of the pie menu.
    bl_label = &quot;Pie Sculpt&quot;

    def draw(self, context):
        pie = self.layout.menu_pie()
        pie.operator(&quot;ps.remesh&quot;, text = &quot;Remesh&quot;, icon=&quot;BLENDER&quot;)
        pie.operator(&quot;ps.mask_brush&quot;, text=&quot;Mask Brush&quot;, icon=&quot;BLENDER&quot;)


def register():
    bpy.utils.register_class(PS_Remesh)
    bpy.utils.register_class(PS_MaskBrush)
    bpy.utils.register_class(VIEW3D_MT_pie_sculpt)


def unregister():
    bpy.utils.unregister_class(PS_Remesh)
    bpy.utils.unregister_class(PS_MaskBrush)
    bpy.utils.unregister_class(VIEW3D_MT_pie_sculpt)

if __name__ == &quot;__main__&quot;:
    register()
    
    bpy.ops.wm.call_menu_pie(name=&quot;VIEW3D_MT_pie_sculpt&quot;)