Access variable from scripts

Product: PowerShell Universal
Version: 4.2.6

hi maybe a stupid question but i have dashboard where i can do various checks (like 20-30) and then i update some array to display table with output of those checks.
Its working but code itself became very not friendly to read
I thought i will move this part of code to separate script - this will allow me to clean the main dashboard code.
But here comes a catch - when i use array in script is not accessible back in dashboard when job is finished.
I tried few things that came to my mind like returning this variable at the and of the script and assign job execution to variable in dash code but its not working

I know such things works in API calls or modules but how to achieve it in scripts ?