Home Reference Houdini Object Model hou 

hou.setSessionModuleSource function

Sets the contents of the hou.session module. The new contents is made available immediately. You do not have to re-import hou.session.

setSessionModuleSource(source)

This function throws a hou.OperationFailed exception if it fails to update the hou.session module. This can happen if the new contents has syntax errors.