Runs some R code with no modules loaded except for those that you provide, without affecting your current modules.
Examples
system2("python3", "--version") |> with_only_modules("python", code=_)
#> ✔ Successfully purged modules
#> ✔ Successfully loaded python
#> ✔ Successfully purged modules
#> ✔ Successfully loaded hdf5/1.12.2