Found it!
It turns out create_from_image() is a static method of ImageTexture. So I changed the code to this:
print("load image:"+cache_path)
var image = Image.new()
var err = image.load(cache_path)
if err != OK:
print("File not loaded:",err)
var texture=ImageTexture.create_from_image(image)
$photo.texture = texture
And now it works!
Note to self: keep checking the debugger messages, even the yellow ones.