I would suggest to add a function `scan` to this module and then register a handler that calls to the scan function outside the module.