Let's say in a file A.py and I am computing value of some variable x by some lengthy procedure, such that code takes around 15-30 seconds to execute.
I want to use value of x in another program B.py.
I have thought of importing x to another file B.py but when B executes, it executes A again in order to calculate x. B takes another 1-2 minutes to execute, so it's essential that I just use the output x. I tried to put it under if __name__ == "main", but how will I compute x then?
Also, I have tried copying the value of x to a text file as mentioned here, but x is a very large list (around 10000 length), so output just shows "..." and omits printing most of it.