Confusion with ExpireSolution()

I am trying to change number slider attributes from within a python script. Based on what I understood, ExpireSolution(True) and ExpireSolution(False) expire the component, with ExpireSolution(True)
running a new solution afterward. However, It is only when I use ExpireSolution(False) during a solution that I get an error “Object expired during a solution”. ExpireSolution(True) works fine under the same condition.

why am I not getting the same error with ExpireSolution(True) ???

ExpireSolution.gh (7.3 KB)

Because the true value starts a new solution, so now you’re running a solution inside another solution. The inner solution solves the object so when the outer solution is allowed to continue, the object is no longer expired.

It’s not good news though, running nested solutions can lead to all sorts of weird side effects.

1 Like

You can use callback method.You can look at this post: Can’t quite figure out how to use ScheduleSolution

callBack
ExpireSolution+.gh (9.7 KB)

1 Like

Thanks for the explanation and the example.

Just a simple question.
Running NewSolution(True) from within a solution should cause Grasshopper to enter an infinite loop and crash Rhino. However, When I try NewSolution(True) in ghpython, nothing happens.

Why Rhino is not crashing?

NewSolotion