ahh yes indeed.
way i tried to define the variable $textField in the procedure for building the GUI?
yes $textfield is a variable that lives inside the scope of makeOBJexportUI, so you are passing the command absolutely NOTHING. see your script is long dead by the time the button is pressed. Its gone. So you must encode the NAME into the call not the actual variable, but its contents. So you make itpart of the string.
so this si what happens
makeOBJexportUI gets called
gui is built
makeOBJexportUI ends and everything in its local space is cleaned away. $textField is no more (or worse if it is its not THIS $textField)
however you have a second problem that is as follows:
proc export (string $prefixName)
proc OBJexport (string $prefix)
also DO no longer live when you press the button you must also make them global
global proc export (string $prefixName)
global proc OBJexport (string $prefix)
However now you REALLY dont want to call the procedure export unless you want to get into big trouble.
PS: there s quirk in maya that when you declare anything in script editors base level it becomes GLOBAL. this can suae things to work out in the script editor while nolonger in file. you are warned.