I’m working on a flask app. There is the app.py file which uses an imported variable:
from other_file import rnd
def some_func:
return rnd
and other_file.py
import random
rnd = random.randint(100000, 1000000)
On each request, the returned value of the function is different. Why?
What if I want to store some app-wide data in a variable, for example:
logged_in_users_list = []
Would that be emptied after each request too?
(Actually I use a similar approach in a FastAPI app, and the variable keeps the list fine. What makes the difference?)