scripts: Move modules scan into separate function