Use selective local import and place at the head of the required code block
Add more necessary local imports
Fix mistaken imports
Remove unnecessary imports
Merge pull request #1813 from 9rnsr/fix_imports

More local import fixes
Fix issue 4673