Make a variable global and use it for inline script

Make a variable global and use it for inline script