ive used a pickle in the past for sharing variables across scripts as well as putting a memory to the variables..
Code: Select all
import pickle
with open('objs.pickle') as f:
aaa, bbb = pickle.load(f)
def save():
with open('objs.pickle', 'w') as f:
pickle.dump([aaa, bbb], f)
this uses a separate file to save the variable to, an issue can come about if 2 scripts try to save at the same time, you can get around this by using 2 pickles, one script would save to file 'a' and read from file 'b', the other script would save to file 'b' and read file from 'a'
or you could import the def
Code: Select all
from file_name import function_name
or import the full script
then