On the OSL node, you can automatically switch the source mode of a shader that you already have on the node.

OSL Switch Source: File → Text

OSL Switch Source: File → Text

OSL Switch Source: Text → File (a save directory will need to be defined)

OSL Switch Source: Text → File (a save directory will need to be defined)