Defending Your Life is a 1991 American romantic comedy-fantasy film about a man who finds himself on trial in the afterlife, where proceedings examine his lifelong fears, to determine whether he’ll be (yet again) reincarnated on Earth, or move on the next phase of existence. Written, directed, and starring Albert Brooks, the film also stars Meryl Streep, Rip Torn, Lee Grant, and Buck Henry. Despite comedic overtones, the film also contains elements of drama and allegory.

https://en.wikipedia.org/wiki/Defending_Your_Life