Why am i getting error variable not defined in kivy app? [solved] | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
+ 1

Why am i getting error variable not defined in kivy app? [solved]

Here is the code which gives me error click_check not defined. https://code.sololearn.com/c02IFC64KmIw/?ref=app Edit: the error occurs at line 57 inside on_text function

18th Jul 2021, 3:16 PM
Abhay
Abhay - avatar
2 Answers
+ 1
NotAPythonNinja i don't understand about why it shouldn't work. There is another function print_text that calls the click_check defined in def build function and things work fine . But thanks a lot , after declaring the variable outside class , it works for on_text as well .
18th Jul 2021, 8:09 PM
Abhay
Abhay - avatar
+ 1
NotAPythonNinja ty ,finally i understood. click_check was local to build . And print text was creating new variable after calling global click_check (which did nothing)
19th Jul 2021, 11:51 AM
Abhay
Abhay - avatar