I would recommend using $NAMESPACE. You could create a simple function that can be called within your ObjectScript that sends the namespace you which to switch to as a parameter. Once the function completes and leaves the execution stack the code will be set back to the calling namespace.

GetNSMPData(P1) PUBLIC
{
new $NAMESPACE
set $NAMESPACE = P1
;
// You method for querying your data here
;
quit rValue
}

Best of Luck,
Jason