One of the great new features in Battlefield 2042 is that it allows you to play All-Out Warfare modes entirely solo, or with some friends, against the AI. All of the game's maps are available, and you can even pick from three AI difficulties.
DICE recently capped the character progression you can earn per day playing solo/co-op, but the developer did not touch the weapon XP side of that - the real reason why you'd want to jump into a bot game anyway.
Unlocking gun attachments in Battlefield 2042 is, frankly, a steep grind. It doesn't help that so many of them are simple cosmetic variations that don't make any new changes to how the weapon performs.