The GhPython Script doesn't generate object automaticly

Back ground: There two ghpython scripts, the first one collects links-mesh and axes points of robot, create a instance of self-defined class robot. The second one takes the robot object, tool object, commands and simulation progress.

if I open the first ghpython script, click the “test” or “ok” button, it create an robot object and deliver it to the second ghpython script, then it works.

But if I do some changes, which update the second ghpython script(for example clicking the “Test” button ) , although the panel after the first script shows the object is there, it alarms:
Runtime error(NullReferenceException): Object reference not set to an instance of an object

if I add a variable “activator” and move the “simulation” slider, then the first script will generate new robot objects, the second will work without alarm.

My conclusion is that, gh runs the scripts if its input changes.
My question is that, why the second scripts doesn’t take the old robot object, actually it is a constant? How can the second one take the robot object as a constant?