A series of new polyesterimides (PEIs) containing photochromic azobenzene moieties have been synthesized. For this purpose the following diesterdianhydrides with azobenzene groups have been prepared: 2,2'-{4-[(4-nitrophenyl)-azo} phenyl]iminobis(ethyl benzene-1,2-dicarboxylic acid anhydride-4-carboxylate), 2,2'-{4-[(4-methylphenyl)-azo}phenyl] iminobis(ethyl benzene-1,2-dicarboxylic acid anhydride-4-carboxylate) and 2,2'-{4-[(4-fluorophenyl)-azo}phenyl] iminobis(ethyl benzene-1,2-dicarboxylic acid anhydride-4-carboxylate). The polyesterimides have been obtained from diesterdianhydrides and 1,3-phenylenediamine using high-temperature polycondensation. The resulting polyimides are characterized as having good solubility in some solvents, high glass transition temperatures (168-210°C) and good film forming properties. The irradiation with linearly polarized light causes a reorientation of the azobenzene groups by angular-selective E/Z photoisomerization. In this way optical anisotropy is induced in the initially isotropic films casting from solution of the amorphous polymers. The photoinduced dichroism in the films has been measured to investigate the effect of azobenzene substitution.