Hello, good question, as an engineer I can tell you that painting will negate the benefit on the outside, unless your paint is reflective. If there is an air gap on the back side of the foil - and only if there is an air gap - then this surface will block heat / cold from radiating to the inside. Think of attic insulation with the foil side facing the inside of the attic, so that the foil is in contact with air - this is good. Foil facing and in contact with the roof, not good. If the back of the foil is in contact with something, you will not block heat transfer.
Good luck!
Colleen