Put it into a class like:
class fruit:
a = 0
def apple(self):
self.a = 2
def orange(self):
if(self.a == 2):
print('your fruit is apple')
a = fruit()
solved how to use function’s variable in another one python