I made 2 programs for show porpose. I would like to import the global variable from the transmitter function into another file, yet the problem that I encounter is that the While true loop also comes along spoiling my whole second program, because the second problem now also starts to show the itiration.
Program 1:
import time
def transmitter():
global temp
global temp
temp = 2
transmitter()
while True: # a random task just to see if I only imported the function
x = 0
print(x + 1)
time.sleep(0.2)
Program 2:
from transmitguy import transmitter
def valuepullup():
newval = transmitguy.transmitter()
print(newval)
valuepullup()
I only need my second program to show the value of 2 once. (2 is the globalvar from file 1)