I would recommend using shared business objects for this scenario. It appears that you are looking up a process instance outside of the process implementation. Marking a business object as shared is the mechanism for sharing between processes, but it is also used for other external access scenarios. In my sample, I marked my business object as shared:

I then have a Service Flow that is called by an external client. A script in this Service Flow has code like this to read and update the values of the business object, which are seen by the original process:
tw.local.customerVar = new tw.object.Customer(tw.local.sharedBOKey);
tw.local.customerVar.firstName = "Some new name";
tw.local.customerVar.save();
The shared business object is created in the original code with code like this in a script activity of the process, which is where you also get the key to look up the shared business object from the external client:
tw.local.customerVar = new tw.object.Customer();
tw.local.sharedBOKey = tw.local.customerVar.metadata("key");
I hope this helps,
Grant.