Fixing finding pretty printers in submodules

Consolidated the same searching code to a function