Johannes Saam Posted March 15, 2011 Share Posted March 15, 2011 hou.session.start() hey! Can someone help with an example on how to use hou.setSessionModuleSource( source ) ? i am trying to programatically add stuff to the current session i have a .py file with a one line function def test(): print 'test' in it only and i am trying hou.setSessionModuleSource( 'path/to/py/file' ) and i get a syntax error in my py file.. i might not be a python god but those 2 lines seam perfect to me Can anyone elaborate on how to use this module? Thanks Jo Quote Link to comment Share on other sites More sharing options...
graham Posted March 15, 2011 Share Posted March 15, 2011 (edited) Setting the session module source is equivalent to editing it through the dialog, meaning it needs string data that contains your code, not a file path, as the argument. If you are reading from a file then you need to read it all in, then set the source. f = open("/home/gthompson/tooldev/scripts/python/parmutils.py") hou.setSessionModuleSource(f.read()) f.close() Edited March 15, 2011 by graham Quote Link to comment Share on other sites More sharing options...
Johannes Saam Posted March 15, 2011 Author Share Posted March 15, 2011 awesome! thats all i needed! rock on Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.