How to set positive and negative collision in python?

I have a static cube object that activates an event when the player collides with it.
The thing that I want to set up is that only one side of the cube activates the event. So colliding with just one polygon of this cube, so when the player would collide with any other side of the cube, nothing would happen.
I figured the easiest way would be to assign a unique material only to that one polygon of the cube object.
But this still doesn’t work and it activates the event when colliding from any side of the object.
So I have tried to set sensors for 2 materials when colliding with the first one and not colliding with the second one would activate the event.
This still activates the event when colliding from any side.
How should I write the script for this to work and can I specify a negative collision?

collision = cont.sensors['sensor']
collision2 = cont.sensors['Sensor2']
if collision.positive and collision2.positive:

How should I write it for collision2 to be a negative collision?

uncheck invert first then:

if collision.positive == True and collision2.positive == False: notice the : is only at the end of an expression line

that wont work, blender do not check for single polygons only whole objects, use a invisible collider object instead.

here is an example of how i normally do this type of setup.
demo.blend (514.4 KB)

The : was my mistake, I didn’t wanted to write it there.
I have tried to replicate what you suggested but it didn’t work.
Here is a test file:
testCollision_001.blend (528.9 KB)

Thank you for your suggestion.
The thing is, I didn’t wanted add another static object in the scene since I would have around 100 or more of these.
So you are saying that colliding with a single polygon doesn’t work even if I set it to have it’s own texture?

yes that is exactly what i am saying, i don’t know if it is a limitation or a bug.

instead of using 2 collision sensors, do it like this, it gives the same result and you eliminate an extra collision test.

Yes I might do that thank you.
But it was meant to be collisions for two different textures.

yes things would be so much easier if that where possible.

(i assume you meant material )

Yes, materials my bad.

searching each poly for a material filter is gonna be a good deal slower than an extra object dedicated to collisions. my guess anyhow.

You are right, that might be true. I’ll do what edderkop suggested.
It seems to be the only way.

I have managed to script it without the use of another static object.
Since my game layout is based on a grid and the object is a cube, I was able to restrict the collision based on the world position of the player compared to the cube.