Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR PYTHON

how to access variable from another function in same class in python

class ClassName :
	function __init__(self):
    	self Num1 = 9
        Num2 = 7
        
    function getNum1(self):
    	1stNumber = Num1
        2ndNumber = Num2
        # It can't get the 2nd number because the variable doesn't have self before it
 
PREVIOUS NEXT
Tagged: #access #variable #function #class #python
ADD COMMENT
Topic
Name
2+8 =