You can do the following to get the path to the TOP node:
import hou
node = hou.nodeBySessionId(self.customId)
print node.path()
The code in the Python Script node is evaluated in PDG's Python context, and the
self object is a reference to the underyling PDG node. Depending on the parameters, the script may be evaluated in the current process or out of process/on the farm. When evaluated in-process the code runs on a background thread, and it's generally unsafe to make modifications to the Houdini session using the
hou module. It's fine to look up the path, but constructing nodes/changing parameters in unsupported.