How to run fucntions when logged in to moralis?

Im using the boilerplate code and when I log in I have access to the moralis object, but how can i use moralis outside the login function?

async function login() {
  let user = Moralis.User.current();
  if (!user) {
   try {
      user = await Moralis.authenticate({ signingMessage: "Hello " })
      const userAddress = user.get('ethAddress')
      document.getElementById("user").innerHTML = userAddress;

        // get BSC native balance for a given address
        const options = {chain: "bsc",address:userAddress}
        const balance = await Moralis.Web3API.account.getNativeBalance(options);
        const uBalance = balance['balance']
        document.getElementById('balance').innerHTML = ubalance;
   } catch(error) {

But how can I run this function on a button click?
Since this fucntion is outside the login function

async function getNFT(){
    const userAddress = user.get('ethAddress')
    const option = { q: "Pancake", chain: "bsc", filter: "name", address:userAddress };
        const NFTs = await Moralis.Web3API.account.getNFTs(option);

Since its outside the login function I cant use moralis stuff, like user.get

try with let user = Moralis.User.current(); before use.get

there is no other way than to call this in every function again?

maybe you can make a global variable
what is the problem with calling it in every function? (it may use a cache)

I guess there is no problem and i will doit just like that.
I dont know why i thought i have to do it in a global type of way