Hello, do yourself a favour and please read How to get the best out of this forum and modify your post accordingly (including code tags and necessary documentation of your ask).
—-
You can’t use a local variable in another function. Make it global or return it or pass that as a parameter