Forum Discussion
Hi,
There are two ways of calling a routine from another project:
1. Without copying, add the reference to the routine and use USEUNIT / uses.
2. Copy the necessary routines only to a new unit in the project and use the USEUNIT / uses as well.
- vik339 years agoOccasional Contributor
Hi Dmitry_Nikolaev,
I have tried both the methods to call a function from another project. Call goes fine but script execution fails due to object not found error. How would i make use of the NameMapping objects that belong to Project 2.To make it simple:
' Unit A has a reference for unit B
'Unit A is in Project A
'call is from unit A to --> sub B of unit BUnit A
'calling sub B from unit A (below statement)
unit B.Sub B-------------------------------
'Unit B is in a Project B and has its own Namemapping.
Unit BSub B
' here obj_B is getting used.
end subHere is the issue:
NameMapping for Project A has something like:
Aliases.Process_A.obj_Parent.obj_ANameMapping for Project B has something like:
Aliases.Process_A.obj_Parent.obj_BThe script tries to find obj_B in the NameMapping for Project A which is what causing it to fail.
How would i make sure that obj_B should be found in NameMapping of Project B?
Please note that if i execute Sub B from project B on its own (without calling it from Proj A) then it passes without any issues.
Please help.
- djadhav9 years agoRegular Contributor
vik33, you should look at merging your namemapping files. Here is an article that shows how to do it.
- vik339 years agoOccasional Contributor
djadhav Thanks for your reply. The only reason why i am doing all this is this - If i keep everything in one project my Object Repository (NameMapping) becomes quite large and then i start having issues like :
- object identification
- Project takes 4-5 minutes to open.
The application is based on JAVA Swing objects. I have to populate different windows from the main windows and it's hard to specify properties to all the windows so that no object identification issues occur (or i am not good at object identification techniques). So, i thought keeping different scripts in different projects means - every script will use its own NameMapping and will have no conflicts of object identification. But i guess, that's not right. Even if i refer any script from projectB from ProjectA, it would still use NameMapping of ProjectA.
Any other solution to this problem?
Thanks for your time.
-Vik