Switch OCIO contexts during a Maya session

OCIO configuration files allow for the use of contexts, which are essentially environment variables that refer to color transform files. Contexts can be used to facilitate per-shot color grading, for example.

If you are using OCIO contexts, you can change their value during a session without restarting Maya. To do this, use MEL or Python commands to change the environment variable and then refresh the color management preferences.

For example, suppose that your configuration file uses a context named SHOT, which is currently set to abc123.spi1d, and you want to change it to ijk456.spi1d. In this case, you can run the following lines of MEL in the Script Editor:
putenv "SHOT" "ijk456.spi1d";
colorManagementPrefs -refresh;