Not Defined - Global Name

I have a Project Script where I keep getting an error when I call it from a component expression. The error states "global name not defined". Do you know what could be causing this issue?

chill_example.txt (1.3 KB)


In the future, post your code as preformatted text as it will be easier to copy/paste to show you what the problems could be.

Looking at your script, you're referring to PouringFurnaceCopy_Melting_Summary_HWS_DISA.Chill.ATAS but that's not defined anywhere in your script or passed as a parameter. If this is a tag, you'll need to use a readBlocking function to read this value before you can use it.

Edit: Or, if it's meant to be a string, then it needs to be enclosed in quotes.

1 Like

Looking at the text file you provided, you will need to pass the location as a parameter.

def chillMetric(location):
    #Create Params
	    thermal_params = {"measure_loc":location}

With the runScript expression similar to:

runScript('Melting.Fitting.chillMetric', {self.view.getChild("root").custom.location})

Note that you may have to adjust the path to the property.

1 Like

Don't forget the non optional poll rate param on runScript when passing arguments.

1 Like

I must have overlooked the text file. See it now, but it doesn't match the screenshot.

Yeah, need to do like you said, plus add the poll rate parameter.

I am using Vision, however I have referenced it this way in the past with Perspective.

If the script is in a scripting file, you have to pass the parameters (no matter if you're using Vision or Perspective). You tagged the post as Perspective, so you got an answer using perspective.

I did it for them.

1 Like

Yep, just realized that. Its actually vision.

This worked. I had to adjust the path property since this was done in vision. -Thanks

1 Like