· Apr 12, 2023

Code to copy class definition from one Namespace to another?

I have a situation where I have a handful of classes which I need to copy to another Namespace (which uses a different RoutineDB) on the same instance, load it and compile it.

Can anyone help me come up with a command that will do this quickly and easily?   Perhaps something with extended reference?  

This is somewhat time sensitive so thank you in advance for your ideas!

Discussion (23)7
Log in or sign up to continue

I know this is old, but recently I found a new way to export/import a package to a global, this may simplify the solution.

1) create a studio project with all the classes that need to me exported. This can be done programmatically, create an instance of %Studio.Project, use AddItem()...etc.

2) Export the project to a global like ^IRIS.Temp("myProjExport"). Open %Studio.Project, export ot global using DeployToGbl() method

3) in target namespace import calling ##class(%Studio.Project).InstallFromGbl()

Using ^IRIS.Temp has the advantage of easy/shared access from all namespaces.