Making modules iterable and catching Exception