Saving custom variables with HIP-file

   543   4   2
User Avatar
Member
11 posts
Joined: Aug. 2024
Offline
Hello, i am currently trying to set up a simple shelf tool that allows the user to select some directories, and save the paths as variables like $CLIENT $SHOT $ASSETS etc. Everything is working fine, but the variables are not saved with the hip file, so i have to set them again every session. I am using "hou.putenv" to create the variables, is there a way to make them save with the hip file, or another approach to achieve the same effect?
User Avatar
Member
25 posts
Joined: Dec. 2015
Offline
I've never been able to find a pure Python solution, but calling
hou.hscript(f'set -g {key} = {value}')
has worked for me.
Edited by erikcarlson - Oct. 14, 2024 21:48:29
User Avatar
Member
11 posts
Joined: Aug. 2024
Offline
Thank you! Works like a charm so far.
User Avatar
Member
580 posts
Joined: Aug. 2014
Offline
Have a look at Context Options [www.sidefx.com].
User Avatar
Member
11 posts
Joined: Aug. 2024
Offline
ajz3d
Have a look at Context Options [www.sidefx.com].

This also seems like it would work. Apart from having to use @ instead of $, do you know if there are any functional differences between the two ways of doing things (context options vs environment vars)? Or is it just a use whatever is easier situation?

Thank you for the guidance.
  • Quick Links