Hi all

Let me show you first my code

```
class Cube:
def __init__(self, x, y, indice, ob):
self.x = x
self.y = y
self.ob = ob
self.indice=indice
def run(origin):
cubes = []
red = makeMaterial('Red', (1,0,0), (1,1,1), 1)
white = makeMaterial('White', (1,1,1), (1,1,1), 1)
black = makeMaterial('Black', (0,0,0), (1,1,1), 1)
indice = 0
# Create the game board
cubes = []
for i in range(1,6):
for j in range(1,6):
bpy.ops.mesh.primitive_cube_add(location=(i,j,0))
bpy.ops.transform.resize(value=(0.5,0.5,0.5))
if ((i%2)==1) and (j%2)==1:
setMaterial(bpy.context.object, white)
indice += 1
ob = bpy.context.object
cubes.append(Cube(i, j, indice, ob))
else:
setMaterial(bpy.context.object, black)
ob = bpy.context.object
cubes.append(Cube(i, j, 0, ob))
setindice(cubes,1,1,2)
test=labyfini(cubes)
def cassemur(cubes):
red = makeMaterial('Red', (1,0,0), (1,1,1), 1)
x=random.randint(1,5)
y=random.randint(1,5)
indicea = 0
indiceb = 0
for Cube in cubes:
if Cube.x == x and Cube.y == y:
if (x%2)==0 and (y%2)==1:
indicea = getindice(cubes,x-1,y)
indiceb = getindice(cubes,x+1,y)
setMaterial(Cube.ob, red) <--- Problem here
if indicea < indiceb:
setindice(cubes, x, y, indicea)
for Cube in cubes:
if Cube.indice = indiceb:
setindice(Cube.x, Cube.y, indicea)
else:
setindice(cubes,x,y,indiceb)
for Cube in cubes:
if Cube.indice = indicea:
setindice(Cube.x, Cube.y, indiceb)
```

Of course , its nor full, i only put the usefull for my problem

The thing im trying to do, is get back my mesh ( that are all in a list cubes as object Cube), in order to color it, i can get my mesh knowing its coordinates x and y.

If someone knows a way of doing that , or even manage to get back my wanted mesh in with a bpy.ops.object.select_something

Thanks for your time