frontend: avoid cyclic imports, and function-local imports
Typical work-around to the "cyclic import" problems in Python is stop
consuming the module contents at the "importing time" (aka "from module
import Class") but delay the consumption to the runtime. We shouldn't
delay the importing stuff to runtime, though.