I am getting error: I'm getting an error: attempt to call function set_shadder_param in base on a null instance

:information_source: Attention Topic was automatically imported from the old Question2Answer platform.
:bust_in_silhouette: Asked By kyadav40

Hello all. Bold part gives the error. Thanks in advance

extends Camera
var http
var loader
var on = 0
var dir = Directory.new()

const TMP_FILE = ‘C:/Users/kunaly/Documents/http_client//tmp0.jpg’

func _process(delta):
#checkInput()
if loader:
var err = loader.poll()
if err == ERR_FILE_EOF: # load finished
var resource = loader.get_resource()
loader = null
set_image(resource)

func get_image():
http.set_download_file(‘C:/Users/kunaly/Documents/http_client//temp’+str(on)+‘.jpg’)
http.request(“http://169.0.0.1:5000/image.jpg”)

func image_downloaded(result,response_code,headers,body):
if result == OK:
if response_code == 200:
loader = ResourceLoader.load_interactive(‘C:/Users/kunaly/Documents/http_client//temp’+str(on)+‘.jpg’)
set_process(true)

func set_image(resource):
get_node(“MeshInstance”).get_material_override().set_shader_param(“Image”,resource)

if dir.file_exists('C:/Users/kunaly/Documents/http_client//temp'+str(on)+'.jpg'):
	dir.remove('C:/Users/kunaly/Documents/http_client//temp'+str(on)+'.jpg')

on += 1
get_image()

func _ready():
set_process(true)
#set_process_input(true)
http = get_node(“HTTPRequest”)
http.set_use_threads(true)
http.connect(“request_completed”,self,‘image_downloaded’)

##
#httpInputRequest = get_node("httpInputRequest")
##could put a return request here
get_image()
:bust_in_silhouette: Reply From: njamster

You’re attempting to call a function called set_shadder_param on something that is a null instance (i.e. doesn’t exist, thus does not have such a function). To fix that, select the MeshInstance-node in the scene tree, then unfold the “Geometry”-section in the property inspector and create a new Shader-/SpatialMaterial as “Material Override”.