edge.use_seam isn't working

Just isn't working, I'm not sure what else to say. There's no errors and it returns True when you call the value.

I'm trying create a script that creates an object and unwraps it. It's as simple as it gets: it creates a plane, selects all the edges, marks seams on all those selected eges and unwraps it into a square texture.

import bpy
import bmesh

bpy.ops.mesh.primitive_grid_add(x_subdivisions = 0, y_subdivisions = 0, radius = 8)

ob = bpy.context.object
me = ob.data

# unwrap
bpy.ops.object.mode_set(mode = 'EDIT')

bpy.ops.object.select_all

for edge in me.edges:
edge.use_seam = True # isn't working

bpy.ops.uv.smart_project(me)


No seams are being added.

Apologies if this ends up being something obvious, I'm new to scripting in Blender.

• Of note is that with a plane that only has the four outer edges, adding seams doesn't make any difference to unwrapping. In your example you will get the same result by creating the plane and using bpy.ops.mesh.uv_texture_add(). Also smart project can be set to break the uv's based on edge angle so doesn't need seams to be set. – sambler Sep 16 '17 at 10:39

If you move your set use_seam loop to above the set edit mode you will get the result that you expect.