Skip to content
Advertisement

Getting list from a function within a different class to a function within a different class

I’m playing around with Kivy a bit and can’t understand why MenuScreen.number_list doesn’t return the list from the MenuScreen class.

JavaScript

Advertisement

Answer

You need to declare number_list as a class property so you can use it, otherwise it’s just a variable with its scope only inside the method.

JavaScript

And also make sure you create an object for the class and call its methods

User contributions licensed under: CC BY-SA
6 People found this is helpful
Advertisement