first of all, **happy new year**!

I "try" to make an inventory with 4 cells or more and 2 various items or more...

![enter image description here][1]

I want to check if the variable x is set to False. If so, then the cell1() function should be x set to True. 
The idea is if x is True then nothing should be collected. In principle, should represent x if the cell is empty or full.
My problem is that x is always "False" after the function has finished???
Why does it work in Python but not in Blender?


    x = "False"
    
    def xReplace(value):
        global x
        x = value
        
    
    def cell1():    
        if sens.positive and x == "False": # sens= message sensor
            var()                          # var()= function update text in cell1/ or end object
            xReplace("True")               # "change the value from global variable x"
            
        elif sens.positive and x == "True": 
            var2()                         # var2()= function update/set in cell2
                   
    cell1()
    print(x)


console prints

    True
    False

I do not understand why it prints variable x twice, and why is the second line False?
I think Blender makes two variables of the same name.? Because when I write print (x == x) then comes twice True. Why does the Blender in this way?
Or is there another way to do it.

  


  [1]: https://i.sstatic.net/TbfqQ.png