would be allowed to source the file even if the shell wasn't interactive.
Check for non-interactive shell and do not source. Check for having already been sourced.