I noticed that I can sample a texture in the Custom Code node by connecting it anywhere in the graph. In the example below I used Input5 on the Custom Code node itself. However this leaves the index of the texture undefined. It could be In1, In2, etc.
Is there a better way to make textures available in the Custom Code node?