Programmatic import in Motoko - #17 by claudio links to an old PR that contains an example of doing this.