A thermally stable polyimide which is blocked at the polymer terminal with a dicarboxylic acid anhydride represented by the formula (III): ##STR1## wherein Z is a divalent radical selected from the group consisting of a monoaromatic radical which is substantially unsubstituted or substituted with a radical having no reactivity with amine or dicarboxylic acid anhydride and has from 6 to 15 carbon a