Update the "Image sampler" component with python

I want to update the image of the “Image sampler” component using python,.But I have some problems,I updated the image link, but the “Image sampler” component is not updated display.
like this:

I want to ask if there is any function that can update the display of the “Image sampler” component.
Thanks for anyone’s advice,Thanks
This is my code:
from Grasshopper.Kernel.Special import GH_ImageSampler
from Grasshopper.Kernel.Special import GH_ImageSamplerAttributes

ghDoc = ghenv.Component.OnPingDocument()
ghObjects = ghDoc.Objects

for i in ghObjects:
    if type(i) is GH_ImageSampler:
#        print i
        i.ImageFilePath = x
        #i.DisplaySettings()
        a = i.ImageFilePath

my gh file:
Image_sampler_test.gh (354.8 KB)

Sorry to Necro a post. But Naruto, did you get an answer to this? This problem has become related to something I am working on.

yes, I thought of a solution later.
You can solve it by calling DisplaySettings(), but it is not perfect.
Another method is to use reflection to call the ReloadImage() method.like this.

Image_sampler_test.gh (186.4 KB)

2 Likes