Problem with adding goals in the List[IGoal]() while running Kangaroo2 in python

I was trying to run the kangaroo with python script.
Although the code works in the end, I do not fully understand how the function works in kangaroo solver.
Sometimes I need to code the following line before I add the goal object into the Goal List.
ks.PhysicalSystem().AssignPIndex(Goal, Tol)
Without the line, the solver will show the Runtime error (AggregateException).
I am not sure why or how this happened. If anyone has hints or ideas maybe?
Thanks in advance.

doubts for (15.5 KB)