Hi there. So as I suspected you have one script which calls another dynamically created one. In the process of creating that other script you insert the name of the (global!) variable which is to be worked upon. Now you want this nameinsertion to work without explicitely passing the name to insert!
I think what you want to achieve is exactly why arguments to functions have been introduced. That you can call the same function with different values (or pointer to objects to be worked upon).
Your dynamic creation has one other major flaw: speed. Each time the simulation is started for a different simulationobject you need to reevaluate the generated simulationscript. If you were to use an argument you could just call the function directly.
Are you perhaps using the name of the object in your simulation script to switch between different cases? In that case I suggest an OOP approach. Just put every specialization into a class-member function and construct a proper inheritance-tree.
Now that we have nailed your question, maybe somebody else has a solution? Even so I would strongly recommend not using it in terms of code serviceability :->
Johannes
Bookmarks