がてら is used to express doing one action while also taking the opportunity to do another. The first action serves as the primary purpose or occasion, and the second action is done alongside it – "while doing A, I'll also do B" or "on the occasion of A, I'll do B as well." It carries the nuance that the speaker is efficiently combining two activities into one outing or occasion.
がてら attaches to: