Getting the image of a texture node that feeds into a node group I have a Cycles material node group like this:



I can access the user-specified color (red) like this:

bpy.data.objects["Suzanne"].data.materials[0].node_tree.nodes.get("MyNodeGroup").inputs[0].default_value[:]

which gives...

(1.0, 0.0, 0.0, 1.0)

I can also hook an image-texture node into that node group like this:



However, bpy.data.objects["Suzanne"].data.materials[0].node_tree.nodes.get("MyNodeGroup").inputs[0].default_value[:] still gives (1.0, 0.0, 0.0, 1.0). 

How can I access the image node? I'd like to get the associated filename and/or image. Thanks!
This is done with searching the node links for one that connects into the node input. The image node is on the other end of that link:

import bpy

mat = bpy.data.objects["Suzanne"].data.materials[0]

# get node input (socket)
socket = mat.node_tree.nodes.get("MyNodeGroup").inputs[0]

# get node link that connects into the socket
link = next(link for link in mat.node_tree.links if link.to_socket == socket)
# get the other node of that link
node = link.from_node

# get the image from node
image = node.image