Is using a 2 gang plastic box as a junction box in an attic area up to code? It would be accessible and not covered by anything (other than a cover plate). Blown in insulation would probably be flush with it.
I like mounting them high on the rafters so you can see them from the attic hatch. (I believe that's code here in Canada. But you're in the states so I cannot comment on that)
they work great for a junction box. just make sure you put a cover plate over it. also in attics where there is not much room and when its hard to move around i like to have the wires a little bit longer and bring the box out towards the center or close to the access hatch and mount it up high like kevin essiambre mention. that way you dont have to go crawling in hard to reach spots if you ever need to access it. now just so you know and depending on your applcation, home depot does sell a product kinda like a plug but is a screw together junction where it allows you to not use a box all together and still remain code legal. i have yet to use one but i did grab one to keep in my car for the next time i come across the need, but im interested in seeing out it works out.
here is the link to what im talking about its called and romex splice kit https://www.homedepot.com/p/Tyco-Electronics-Romex-Splice-Kit-2-Wire-1-Clam-A22899-000/202204326