What @NomadTech said. You don’t have a neutral in either box, so you’ll have to use a “no-neutral” device.

As an aside, the junction box in the attic looks overloaded to me. If that is the case, this is a potential fire hazard. There are capacity limits to boxes based on the number of wires, the gauge of the wires and the number of devices, if any.

A simple fix would be to swap the attic box out with a larger capacity box, such as a square.