You could track their instance GUIDs and do something like this (i.e. you will want to expire components with specific instance GUIDs):
And if you’re running this from a Rhino button, you can replace ghenv.Component.OnPingDocument().Objects with Grasshopper.Instances.ActiveCanvas.Document.Objects.
Edit: You could also target components with specific names, substrings etc. if working with GUIDs aren’t appropriate.
Finally it works as expected!
The script inside the button looks like:
!_-RunPythonScript (
import Grasshopper
for obj in Grasshopper.Instances.ActiveCanvas.Document.Objects:
if obj.NickName == "recompute":
obj.ExpireSolution(True) )
Pressing this button makes the object “recompute” to load again’; the rest of the definition does nothing.