Making a grid transparent

I have a 2D image object in my scene, on top of which I would like to place a grid of points. However, the grid object appears to be opaque on one side: the image can be seen nicely from one side, but from the other side only the opaque grey grid plane can be seen. I would like to make the grid object transparent (only the grid lines and points visible) so that the image can be seen from both sides. The following code changes the color of the grid, but the object remains fully opaque:

bpy.ops.mesh.primitive_grid_add() # arguments are provided so that the grid object lies exactly over the image
mat = bpy.data.materials.new("_mat_grid")
mat.use_transparency=Truemat.alpha = 0.2
mat.diffuse_color = (0.2,0.8,0.8)

Any suggestions for how I can make the grid transparent would be much appreciated, thanks!

You can leverage the object display type for that.


import bpy


ob = bpy.data.objects.get("Grid")
ob.show_all_edges = True
ob.draw_type = 'WIRE'

That works, thanks Atom!