Two types of novel poly(esterimide)s with rigidly and flexibly attached azobenzene chromophores to the main chain were synthesized and characterized. Poly(esterimide)s with rigidly bounded chromophore were synthesized from 4,4′[diphenylopropane-di(benzene-4-estro-1,2-dicarboxylic)]anhydride and 2,4-diamino-4′-cyanoazobenzene and 2,4-diamino-4′-methylazobenzene. Poly(esterimide)s with flexible i.e. by aliphatic spacer (–O–(CH 2) 6–O–) bonded azo-dye were prepared from hydroxyl poly(esterimide) by the covalent bonding of 4-[4-(6-hydroxyhexyloxy)phenylazo]benzonitrile and 4-[4-(6-hydroxyhexyloxy)phenylazo]toluene via Mitsunobu reaction. The degree of functionalization of the poly(esterimide)s was estimated by UV–Vis spectroscopy. Glass transition temperature ( T g) of the polymers and decomposition temperature ( T d) at 5% weight loss were in the range 167–264 °C and 368−442 °C, respectively. Light-induced anisotropy in poly(esterimide)s and in their analogues poly(etherimide)s was studied by holographic grating recording performed at wavelengths λ 1 = 476 and λ 2 = 514.5 nm using two crossed coherent laser beams. The surface relief gratings which appeared after light exposure were observed by atomic force microscopy.