Your thinking is good, but misguided -  Requiring the module each time the function is called is inefficient, especially because the function would have access to this anyway if it was declared globally.  You were likely thinking this would be cleaner, but the performance hit probably isn't worth it.