Re-fix #11365

This was an issue with python's namespace resolution. Since there were local imports for salt.* python interpreted that meaning salt was a local variable. By moving both imports to globals we no longer need them in the function
Merge pull request #18690 from jacksontj/develop

Re-fix #11365