Pie Menu - how to split a command on the 3 lines of code

Hello. How can I separate (to three) marked yellow line of code to have the possibility to assign different icons for each method of mesh separation?

pie.operator_enum("mesh.separate", "type")

Thx


You can add individual operator calls with different arguments, but you will have to set the text manually (otherwise it will always show as “Separate”):

import bpy
from bpy.types import Menu

sep_names = {
    e.identifier: e.name for e in
    bpy.types.MESH_OT_separate.bl_rna.properties['type'].enum_items
}


class VIEW3D_PIE_template(Menu):
    # label is displayed at the center of the pie menu.
    bl_label = "Select Mode"

    def draw(self, context):
        layout = self.layout

        pie = layout.menu_pie()
        pie.operator("mesh.separate", text=sep_names['SELECTED'], icon='MATERIAL').type = 'SELECTED'
        pie.operator("mesh.separate", text=sep_names['MATERIAL'], icon='BORDER_RECT').type = 'MATERIAL'
        pie.operator("mesh.separate", text=sep_names['LOOSE'], icon='UV_ISLANDSEL').type = 'LOOSE'


def register():
    bpy.utils.register_class(VIEW3D_PIE_template)


def unregister():
    bpy.utils.unregister_class(VIEW3D_PIE_template)


if __name__ == "__main__":
    register()

    bpy.ops.wm.call_menu_pie(name="VIEW3D_PIE_template")


That’s exactly what I meant.
thanks