title: Variable not defined in If statement (Python, Ursina Module)
body: <p>My problem is that when I change the content of the variable &quot;XO&quot; inside the if statement, the one in the condition of the If statement becomes undefined.</p>
  <pre><code>from ursina import *
  import time
  app = Ursina()
  window.title = &quot;Game&quot;
  window.borderless = False
  window.exit_button_visible = False
  
  XO = &quot;X&quot;
  
  class Tile(Button):
      def __init__(self, position = (-5, -5, 0), texture = &quot;assets/tile.png&quot;):
          super().__init__(
              parent = scene,
              model = &quot;quad&quot;,
              color = color.lime,
              position = position,
              texture = texture
          )
      def input(self, key):
          if self.hovered:
              if key == &quot;left mouse down&quot;:
                  if XO == &quot;X&quot;:
                      Tile(position = self.position, texture = &quot;assets/tile_x&quot;)
                      XO = &quot;O&quot;
                  else:
                      Tile(position = self.position, texture = &quot;assets/tile_0&quot;)
                      XO = &quot;X&quot;
                  time.sleep(.005)
                  destroy(self)
                  
  for x in range(3):
      for y in range(3):
          block = Tile((x-1, y-1))
  app.run()
  </code></pre>