please help me understand why this doesn't work and how to change it. I basically want to be able to query values of a var of program one from program two. So here are the most basic programs:
P1:
import time
gscore = 0
def get_info():
return gscore
def main():
global gscore
score = 0
while score <10:
time.sleep(1)
score +=1
gscore = score
print(score)
if __name__ == '__main__':
main()
P2:
from functest import get_info
print(get_info())
The structure may seem a bit weird but basically I have an existing small python game and want to be able to query the score which is why I adapted it in this way. So P1 obviously counts to ten but P2 always gets 0 as a return value. I feel like I'm making a really stupid mistake here... Thx for help :)