I think I figured it out with the help of this answer. I have to build an assembly with all my shared code. Then, in the Powershell script, I just have to:
import-module "d:\path\to\assembly.dll"
Hope that helps someone. And if anyone has a better idea, please share.