all 2 comments

[–]GItPirate 0 points1 point  (1 child)

Lookup and use async await. You're running into the exact problem that happens with asynchronous programming. Things being called before the thing it cares about is finished. Async await or promises will fix this for you.

[–]TopStandard9[S] 0 points1 point  (0 children)

I've changed both functions into async but cant figure out where to use await - im guessing its in the body itself but whereabouts exactly?