Retrieving UDT parameter from a gateway script

For a project I’m working on, I need to pull a parameter back out of a UDT to use in a script. I have the function in a project script and its called by a gateway tag change script. If I test it in the script console it works but if in the project it fails after the system.tag.browseConfiguration. This is running in 7.9.17. Does anyone have any suggestions?

	path = '[Tag_Provider]Tag Folder'
	tname = 'tagName'
	config = system.tag.browseConfiguration(path,False)
	for x in range(len(config)):
		if config[x].getName() == tname:
			params = config[x].getParameters()
			for x in params:
				if x.getValue():
					paramVal = x.getValue()