mirror of
https://github.com/home-assistant/home-assistant.io.git
synced 2025-07-23 09:17:06 +00:00
allow modification of variable in child scope (#2688)
Fixes `NameError: name 'count' is not defined`
This commit is contained in:
parent
717c2ab99e
commit
34009e3096
@ -46,6 +46,7 @@ def setup(hass, config):
|
||||
|
||||
# Listener to handle fired events
|
||||
def handle_event(event):
|
||||
nonlocal count
|
||||
count += 1
|
||||
print('Total events received:', count)
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user