Partial filename from a var

I’m trying to setting up a “modules” system including on each page some partials that are listed in an array in the page .md file.
It work fine with a (long) if/else on each partial that run selectively a static partial inclusion:

{{ partial “modules/example.html” $module }}

I’m trying to do this using the module name directly (avoiding to maintain a log if/else), something like:

{{ $modulefile := printf “modules/%v.html” $modulename }}
{{ partial $modulefile $module }}

{{$modulefile}} Print correctly the partial path (partials/example.html) but compiler return an error that the partial doesn’t exist:

ERROR 2017/07/11 16:35:08 Error while rendering “home”: template: index.html:11:4: executing “index.html” at <partial $modulename …>: error calling partial: Partial “example” not found

What ma I missing? :confused: