The error message is self explanatory, there is no object called lmod
so something must have went wrong on the previous step where you create that object.
If you need more specific help, please provide a proper REPRoducible EXample (reprex) illustrating your issue.