Three-dimensional (3D) printing of porous polyimide (PI) with good oil storage capability for self-lubricating is realized by direct ink writing of poly(amide acid) (PAA) precursor ink followed by post thermal treatment and template removal. The ink is comprised of PAA and polymethyl methacrylate (PMMA) microspheres, where the PMMA microspheres serve as both the pore-forming agent and the rheology modifier to realize high-precision porous PI objects. The printed porous PI exhibited good mechanical performance and thermal stability, and good oil storage capability to various lubricant oils to achieve self-lubricating. Importantly, various parts with desirable complex structures, bearing retainers for example, can be readily accomplished. It is therefore promising for manufacturing high-performance lubricating parts, especially those with high complexity.