Too many loose batteries? Print a couple of these to organize them and hold them together. This was designed to be printed in TPU, it probably won't work right for non-stretchy material.
This will probably work for any cylindrical battery, but I've only tested with sizes AA and AAA.
You can also choose hexagonal or square (not pictured) packing. You can make a set of rings for almost any number of batteries. I've included a variety of shapes and sizes, or you can change the numbers to make the size you want. Note that the hexagonal arrangement has one extra battery in every other row, so a 3x3 hexagonal grid holds 10 batteries.
This currently only supports a rectangular grid arrangement, but I may add circular and triangular arrangements if someone says they want them. (Or other arrangements if suggested.)
I printed this with Sainsmart TPU (shore hardness 95A) which make the overall part surprisingly strong and rigid while individual rings are still stretchy and flexible.