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.
It's only obvious if you know how blender works. What is happening is the mesh data is copied into a bmesh structure when you go into edit mode, this bmesh data is copied back when leaving edit mode. The changes you make to the underlying mesh data while the mesh is in edit mode are overwritten by this process and won't affect the mesh that you see in edit mode.

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