Apr 11, 2019
How To Download Kabaddi Full HD Hindi Movie
Kabaddi - New Nepali Full Movie Ft. Dayahang Rai, Saugat Malla, Rishma Gurung
KABADDI KABADDI - New Nepali Full Movie Ft. Dayahang Rai, Saugat Malla, Rishma Gurung
Category:Kabaddi in India
Category:2013 in Indian sportQ:
How to run a function within another function from within a different class?
How do I run this code from within another class?
a = "0"
def get_a():
print a
b = '1'
def get_b():
print b
def func():
print "This is the function"
print get_a()
print get_b()
def run_func():
func()
A:
In this case, you are calling the func() function in the global scope. You can use self.func() in your other class like this:
class OtherClass:
def __init__(self):
self.a = "0"
self.b = '1'
def get_a(self):
print self.a
print get_a()
def get_b(self):
print self.b
print get_b()
def func(self):
print "This is the function"
print self.a
print self.b
def run_func(self):
self.func()
class MainClass:
def __init__(self):
self.other = OtherClass()
self.other.get_a()
self.other.get_b()
self.other. be359ba680
Related links:
Comments