function bd = loadTemplate(modelTemplateFilePath)
%

%   Copyright 2019-2020 The MathWorks, Inc.

    [~, name, ~] = fileparts(modelTemplateFilePath);

    bd = Simulink.createFromTemplate(modelTemplateFilePath, 'Name', name);

    h = Simulink.PluginMgr;
    h.attach(bd, "ModelTemplatePlugin");

    [mfModel, templateMetadata] = sltemplate.internal.extractTemplateMetadata(bd);
    set_param(bd, "TemplateModel", mfModel);
    set_param(bd, "TemplateMetadata", templateMetadata);
end
