title: Changing a variable's value with Hotkey
body: <p>Here, I have a part of my code which detect if <code>&quot;Esc&quot;</code> pressed or not. Then change running's value to False and terminate while loop</p>
  <pre><code>def exit():
      xx = False
      return xx
          
  while running:
      add_hotkey(&quot;esc&quot;,lambda:exit())
      if exit() == False:
          running = False
  </code></pre>
  <p>But it doesn't work. In <code>if</code> statement, <code>exit()</code> starts changing running's value and terminate while loop without pressing any botton. Any Alternative code?</p>