[Maya 2015 - Python] global variable with scriptjob

Wondering if there is a way to stock a variable in the cache using python.
c# speaking let say a public static I could access at anytime.

Then using a scriptJob, the function called could access to this variable at anytime…

Tried different way already but my variable always print a None content…

Any suggestion?

Thank you :slight_smile:

What about just an environment variable ? It depends on what you want to store

oh my bad…

myVar = “Empty”

def blabla():
global myVar
myVar = “EditContent”

But yes, could be good to use environement variable to have an access on next user session as well…

Thanks!

[QUOTE=sama.van;26828]
But yes, could be good to use environment variable to have an access on next user session as well…[/QUOTE]

Actually saying crap since the user will create many scenes using the tool…
hmm…
I guess I need to write a scene reader to build the variable on new session…

Init files are always a nice way to store things locally.

[QUOTE=Nysuatro;26832]Init files are always a nice way to store things locally.[/QUOTE]

Agreed, Thanks! :slight_smile:

optionVars are the standard way to store persistent variables in Maya. If you want to store settings per file, you can save them using fileInfo.