I've wrote the script for you :
It gets the texture by it's name (*with extension) and inserts it into the Image_Texture node replacing the previously used texture (if such existed)
Note: this works correctly only if you have a SINGLE texture node in your material.
HERE:
import bpy
from bpy.types import ShaderNodeTexImage
image_name = 'texture.png'
for img in bpy.data.images:
if img.name == image_name:
image=img
break
shader_nodes = [a for a in bpy.context.screen.areas if (a.type == 'NODE_EDITOR')][0]
with bpy.context.temp_override(area=shader_nodes):
bpy.ops.node.select_all(action='SELECT')
nodes = bpy.context.selected_nodes
for n in nodes:
if type(n)==ShaderNodeTexImage:
texture_node = n
break
texture_node.image = image