One easy way is to use function scope to control import visibility within a
file:
def prepare_parser(): from pyparsing import Word, alphas, Optional, ... # do stuff, and get the final thing to return return ...parser = prepare_parser()

One easy way is to use function scope to control import visibility within a
file:
def prepare_parser(): from pyparsing import Word, alphas, Optional, ... # do stuff, and get the final thing to return return ...parser = prepare_parser()