Thank you so much for your reply!
getsurfacematerial(0) returns error:
but set_material(material) worked!
I actually had another way that worked for me
I was going to update the answer but you beat me at it!
So what I did was:
onready var selected = preload("res://selected.material")
and in the function:
material = selected
I'm marking your answer as a correct as it seems more standard and professional answer than mine!