The engine should be more or less the same, but some parts (for example engine mounts) and engine tuning is different. The 2017+ models with 94ah battery make 38 hp, instead of 34 hp on earlier models.
Someone had an engine for sale a few days ago on the forum.
I would be surprised if the entire engine needs replacing on your car. A motorcycle mechanics maybe able to fix your engine if it has a mechanical issue.