Isolating some Python functions from running

Hi there,

I hope someone can help with this.

Is there an easy way to isolate a function inside a GHpython component to prevent it from recalculating any time a variable is changed? Kind of controlling which functions can be recalculated and which other not.

A more robust option would be to link a function with an input variable, so this function only gets recalculated if this specific parameter changes.

More specifically, I am computing a cloud of points whether they are inside a volume or not, giving me a dictionary of booleans. If the volume does not change, I do not want this function to recalculate and make the dictionary again, as I have it already! But I do need to run the python component again as there are some other functions going on there.

Any help?
Many thanks!