PEP8:
Imports are always put at the top of
the file, just after any module
comments and docstrings, and before module globals and constants.
It is not bad practice to have scopped imports. So that the import applies only to the function you used it in.
I think the code would be more readable though if the imports where grouped together at the top of the block or if you want it globally at the top of the file.