I made the code in the connected question work successfully after adding a selection of all mesh elements and all UVs:
bpy.ops.mesh.select_all(action='SELECT')
bpy.ops.uv.select_all(action='SELECT')
Before running bpy.ops.uv.seams_from_islands()
Here is the full modified code:
import bpy
import bmesh
context = bpy.context
obj = context.edit_object
me = obj.data
bm = bmesh.from_edit_mesh(me)
# old seams
old_seams = [e for e in bm.edges if e.seam]
# unmark
for e in old_seams:
e.seam = False
# mark seams from uv islands
bpy.ops.mesh.select_all(action='SELECT') # NEW LINE!!!
bpy.ops.uv.select_all(action='SELECT') # NEW LINE!!!
bpy.ops.uv.seams_from_islands()
seams = [e for e in bm.edges if e.seam]
# split on seams
bmesh.ops.split_edges(bm, edges=seams)
# re instate old seams.. could clear new seams.
for e in old_seams:
e.seam = True
bmesh.update_edit_mesh(me)
To obtain separate mesh objects for each newly splitter section, one can add this line at the end:
bpy.ops.mesh.separate(type='LOOSE')