Forum Discussion
Philip_Baird
10 years agoCommunity Expert
Hi minh, why is it you do not want to place the //USEUNIT out side the eval? If you are wanting to access methods which belong to other script files it should just be a matter of including them all at the head of ScriptA.
//USEUNIT ScriptB
//USEUNIT ScriptC
//USEUNIT ScriptD
If you make sure you use the recommended fully qualified accessor <Script>.<Method>, e.g. ScriptB.FindMyProcess() you will have no name clash problems.
Honestly, even if you could do what you are attempting I wouldn't recommend doing it simply because if you base your code around multiple eval() calls it will be an absolute nightmare to work out what went wrong if an Exception occurs.
Also, the Runner.CallMethod() Denis mentioned is a much safer mechanism for doing this.
The only issue is Smartbear has marked this method as obsolete, I really don't know why as in some cases being able to invoke methods in this fashion can be extremely useful and the supplied work arounds mentioned in the documentation do not provide equivalent functionality.
Maybe Smartbear would consider moving Runner.CallMethod() out of obsolesence :)
Regards,
Phil Baird
//USEUNIT ScriptB
//USEUNIT ScriptC
//USEUNIT ScriptD
If you make sure you use the recommended fully qualified accessor <Script>.<Method>, e.g. ScriptB.FindMyProcess() you will have no name clash problems.
Honestly, even if you could do what you are attempting I wouldn't recommend doing it simply because if you base your code around multiple eval() calls it will be an absolute nightmare to work out what went wrong if an Exception occurs.
Also, the Runner.CallMethod() Denis mentioned is a much safer mechanism for doing this.
The only issue is Smartbear has marked this method as obsolete, I really don't know why as in some cases being able to invoke methods in this fashion can be extremely useful and the supplied work arounds mentioned in the documentation do not provide equivalent functionality.
Maybe Smartbear would consider moving Runner.CallMethod() out of obsolesence :)
Regards,
Phil Baird
Related Content
Recent Discussions
- 2 days agoMW_Didata