Proper use of wp_localize_script?

How does your function pw_load_scripts() know about the existence of $dataToBePassed? Is the variable global? Looking at the code you’ve got, I’m guessing that, as far as wp_localize_script() is concerned, $dataToBePassed is a local variable, and it’s probably null.