Код: Выделить всё
def foo():
def bar():
count += 1
print(f'{count=:}')
count = 1
bar()
foo()
Однако удаление счетчика += 1 подтверждает, что счетчик доступен внутри панели.
Код: Выделить всё
def foo():
def bar():
# count += 1 #
Подробнее здесь: [url]https://stackoverflow.com/questions/79244768/how-to-understand-unboundlocalerror-local-variable-count-referenced-before-as[/url]