Memoirs of a Sinner (1986)
Memoirs of a Sinner is a 1986 Polish film directed by Wojciech Jerzy Has, starring Piotr Bajor. The film is an adaptation of a novel by James Hogg and tells the tale of the protagonist Robert and his doppelganger.
More at Wikipedia.