A co-assembled gel of a pyromellitic dianhydride derivative and polyaniline with optoelectronic and photovoltaic properties.