Variables, or rather environment variables, belong to processes, not scripts, scripts change them but they exist with the process.
If you execute a script with "#!/bin/sh" it starts a new process to run the script in, hence a new set of environment variables, children will inherit the parent's exported variables but not the other way round.
The alternative is to run a script using "source" or ".". The down side of this is the script language has to be the same and the error handling must be consistent.