Developing the bases of psychic ability can lead to enlightenment in this very life or the state of non-returning.

Paṭhamaiddhipāda sutta - Bases for Psychic Ability (Second)

"Bhikkhus, before my awakening, when I was still an unawakened bodhisatta, I developed and frequently practiced five qualities. What five?

I developed the basis of psychic ability that is endowed with collectedness arising from aspiration and accompanied by intentional effort, the basis of psychic ability that is endowed with collectedness arising from energy and accompanied by intentional effort, the basis of psychic ability that is endowed with collectedness arising from [purification of] mind and accompanied by intentional effort, and the basis of psychic ability that is endowed with collectedness arising from investigation and accompanied by intentional effort, along with enthusiasm.

Because I, bhikkhus, developed and frequently practiced these five qualities, whenever I directed my mind to realize any higher knowledge, I achieved the ability to witness it, whenever the conditions were present.

If I wished, 'May I experience various kinds of psychic abilities, such as being one and becoming many, being many and becoming one; appearing and disappearing; going unimpeded through walls, ramparts, and mountains as if through space; diving in and out of the earth as if it were water; walking on water without sinking as if it were dry land; flying through the air cross-legged like a bird; touching and stroking the sun and moon with my hand, so mighty and powerful; and controlling the body as far as the Brahma world,' I achieved the ability to witness it, whenever the conditions were present.

If I wished, 'Through the complete wearing away of the taints, may I dwell in the taintless liberation of mind and liberation by wisdom, having realized it with direct knowing in this very life,' I achieved the ability to witness it, whenever the conditions were present."