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

For now, it's not possible in pure python, because the select namespace is specified by the environment variable IRISNAMESPACE, and environment variable can't be change in the parent process, I have tried by reloading iris module with no success.

To achieve that, for now, as Robert says, you have to create an helper method in objectscript ... :(

Class Embedded.Utils
{

ClassMethod GetNameSpace() As %Status
{

    Return $namespace
}

ClassMethod SetNameSpace(pNameSpace) As %Status
{
    zn pNameSpace
    Return $namespace
}

}

Python :

import iris

print(iris.cls("Embedded.Utils").GetNameSpace())
try:
    print(iris.cls("Security.Users").Exists("SuperUser"))
except RuntimeError:
    print("Wrong NameSpace")

print(iris.cls("Embedded.Utils").SetNameSpace("%SYS"))
try:
    print(iris.cls("Security.Users").Exists("SuperUser"))
except RuntimeError:
    print("Wrong NameSpace")