NJL64 How come getting rid of "var" made it work?
When you use var you declare a new variable. If you declare a variable inside a function then that variable is local to function. If, at the same time, the script-wide variable with the same name exists (declared outside of the function), the local variable will take precedence and shadow the script-wide variable inside that function. The consequence in your case is - tween you used inside the function is not tween you declared at the top of the script. So the latter stays uninitialized i.e. null.
https://gdscript.com/tutorials/variables/ (scroll down to "Variable Scope" section)