We have explored the change in alignment of a nematic liquid crystal, 4'-pentyl-4-cyanobiphenyl (5CB) with three types of photosensitive polyimide as the alignment layer by photoirradiation at 366 nm. The photosensitive polyimide alignment layer induced a reversible change in alignment of 5CB. It was observed that the 5CB molecules became aligned from homogeneous alignment to homeotropic on photoirradiation with a d.c. electric field as a bias, and reversed to the homogeneous state when photoirradiation was ceased. This result indicates that optical switching could be repeated by on and off switching of the excitation light at 366 nm. The optical switching of the nematic liquid crystal might be mainly due to a photophysical change in the polyimide surface which is affected by the chemical structures of the polyimides at the temperature at which 5CB exhibits a nematic phase. The optical switching of nematic liquid crystals with photosensitive polyimides as the alignment layer is a novel driving method for nematic liquid crystals