Why make it more explicity that either Lmod or modulecmd is running? Ideally the debug log would also show which executable is called here in case there are system that both in use.