may you use the code it might be helpful
using Mendix.StudioPro.ExtensionsAPI.Model;using Mendix.StudioPro.ExtensionsAPI.UI.Menu;using Mendix.StudioPro.ExtensionsAPI.UI.Services;using System;using System.Collections.Generic;using System.ComponentModel.Composition;
namespace ModuleExtension{ [Export(typeof(MenuExtension))] public class ModuleExtension : MenuExtension { private readonly IAppService _appService;
[ImportingConstructor] public ModuleExtension(IAppService appService) { _appService = appService; }
public override IEnumerable<IMenuViewModel> GetMenus() { yield return new MenuViewModel("Say Hello", () => test()); }
public void test() { // SAFELY retrieve the current model via appService IModel model = _appService.GetModel();
string path = "C:\\Users\\TestModule.mpk";
if (model?.Root != null) { _appService.TryImportModule(model.Root, path, "***", "1.0", 0); } } }}
you have to install the nuget package of the extensibility API
https://docs.mendix.com/apidocs-mxsdk/apidocs/csharp-extensibility-api-10/get-started/