2026-05-08 12:18:48 +00:00
2020-09-24 13:47:11 +00:00
<!DOCTYPE html>
2024-06-01 15:21:33 +00:00
< html class = "writer-html5" lang = "en" data-content_root = "./" >
2020-09-24 13:47:11 +00:00
< head >
2024-06-01 15:21:33 +00:00
< meta charset = "utf-8" />< meta name = "viewport" content = "width=device-width, initial-scale=1" />
2023-09-20 17:06:52 +00:00
2021-01-18 21:09:43 +00:00
< meta name = "viewport" content = "width=device-width, initial-scale=1.0" />
2023-09-20 17:06:52 +00:00
< title > FAQ — MO2 Python Plugin API documentation</ title >
2026-05-08 12:18:48 +00:00
< link rel = "stylesheet" type = "text/css" href = "_static/pygments.css?v=b86133f3" />
< link rel = "stylesheet" type = "text/css" href = "_static/css/theme.css?v=e59714d7" />
< link rel = "stylesheet" type = "text/css" href = "_static/graphviz.css?v=4ae1632d" />
2024-06-01 15:21:33 +00:00
2020-09-24 14:17:15 +00:00
< link rel = "shortcut icon" href = "_static/mo2.ico" />
2026-05-08 12:18:48 +00:00
< script src = "_static/jquery.js?v=5d32c60e" ></ script >
< script src = "_static/_sphinx_javascript_frameworks_compat.js?v=2cd50e6c" ></ script >
< script src = "_static/documentation_options.js?v=5929fcd5" ></ script >
< script src = "_static/doctools.js?v=9bcbadda" ></ script >
< script src = "_static/sphinx_highlight.js?v=dc90522c" ></ script >
2023-09-20 17:06:52 +00:00
< script src = "_static/js/theme.js" ></ script >
2020-09-24 13:47:11 +00:00
< link rel = "index" title = "Index" href = "genindex.html" />
< link rel = "search" title = "Search" href = "search.html" />
2024-08-09 08:57:44 +00:00
< link rel = "next" title = "API Reference" href = "autoapi/index.html" />
2020-09-24 13:47:11 +00:00
< link rel = "prev" title = "Writing Plugins" href = "writing-plugins.html" />
</ head >
2023-09-20 17:06:52 +00:00
< body class = "wy-body-for-nav" >
2020-09-24 13:47:11 +00:00
< div class = "wy-grid-for-nav" >
< nav data-toggle = "wy-nav-shift" class = "wy-nav-side" >
< div class = "wy-side-scroll" >
< div class = "wy-side-nav-search" >
2023-09-20 17:06:52 +00:00
< a href = "index.html" class = "icon icon-home" >
MO2 Python Plugin API
2020-09-24 13:47:11 +00:00
</ a >
< div role = "search" >
< form id = "rtd-search-form" class = "wy-form" action = "search.html" method = "get" >
2023-09-20 17:06:52 +00:00
< input type = "text" name = "q" placeholder = "Search docs" aria-label = "Search docs" />
2020-09-24 13:47:11 +00:00
< input type = "hidden" name = "check_keywords" value = "yes" />
< input type = "hidden" name = "area" value = "default" />
</ form >
</ div >
2023-09-20 17:06:52 +00:00
</ div >< div class = "wy-menu wy-menu-vertical" data-spy = "affix" role = "navigation" aria-label = "Navigation menu" >
< p class = "caption" role = "heading" >< span class = "caption-text" > Contents:</ span ></ p >
2020-09-24 13:47:11 +00:00
< ul class = "current" >
< li class = "toctree-l1" >< a class = "reference internal" href = "setup-tools.html" > Setting up the environment</ a >< ul >
< li class = "toctree-l2" >< a class = "reference internal" href = "setup-tools.html#required-tools" > Required tools</ a ></ li >
< li class = "toctree-l2" >< a class = "reference internal" href = "setup-tools.html#preparation" > Preparation</ a >< ul >
< li class = "toctree-l3" >< a class = "reference internal" href = "setup-tools.html#get-the-mobase-stubs" > 1. Get the < code class = "docutils literal notranslate" >< span class = "pre" > mobase</ span ></ code > stubs</ a ></ li >
< li class = "toctree-l3" >< a class = "reference internal" href = "setup-tools.html#configure-visual-studio-code-for-mobase" > 2. Configure Visual Studio Code for < code class = "docutils literal notranslate" >< span class = "pre" > mobase</ span ></ code ></ a ></ li >
2021-02-26 18:26:36 +00:00
< li class = "toctree-l3" >< a class = "reference internal" href = "setup-tools.html#optional-configure-black-to-auto-format-your-source-files" > 3. [Optional] Configure < code class = "docutils literal notranslate" >< span class = "pre" > black</ span ></ code > to auto-format your source files</ a ></ li >
2021-01-18 21:09:43 +00:00
< li class = "toctree-l3" >< a class = "reference internal" href = "setup-tools.html#optional-automatically-reload-plugins-during-development" > 4. [Optional] Automatically reload plugins during development</ a ></ li >
2020-09-24 13:47:11 +00:00
</ ul >
</ li >
< li class = "toctree-l2" >< a class = "reference internal" href = "setup-tools.html#testing-the-setup" > Testing the setup</ a ></ li >
</ ul >
</ li >
< li class = "toctree-l1" >< a class = "reference internal" href = "plugin-types.html" > Type of Plugins</ a >< ul >
< li class = "toctree-l2" >< a class = "reference internal" href = "plugin-types.html#installers" > Installers</ a ></ li >
< li class = "toctree-l2" >< a class = "reference internal" href = "plugin-types.html#previewers" > Previewers</ a ></ li >
< li class = "toctree-l2" >< a class = "reference internal" href = "plugin-types.html#mod-page" > Mod Page</ a ></ li >
< li class = "toctree-l2" >< a class = "reference internal" href = "plugin-types.html#game" > Game</ a ></ li >
< li class = "toctree-l2" >< a class = "reference internal" href = "plugin-types.html#tool" > Tool</ a ></ li >
< li class = "toctree-l2" >< a class = "reference internal" href = "plugin-types.html#proxies" > Proxies</ a ></ li >
< li class = "toctree-l2" >< a class = "reference internal" href = "plugin-types.html#free-plugins" >< em > Free Plugins</ em ></ a ></ li >
< li class = "toctree-l2" >< a class = "reference internal" href = "plugin-types.html#extension-interfaces" > Extension Interfaces</ a >< ul >
< li class = "toctree-l3" >< a class = "reference internal" href = "plugin-types.html#diagnose" > Diagnose</ a ></ li >
< li class = "toctree-l3" >< a class = "reference internal" href = "plugin-types.html#file-mappings" > File Mappings</ a ></ li >
</ ul >
</ li >
</ ul >
</ li >
< li class = "toctree-l1" >< a class = "reference internal" href = "writing-plugins.html" > Writing Plugins</ a >< ul >
< li class = "toctree-l2" >< a class = "reference internal" href = "writing-plugins.html#getting-started" > Getting started</ a >< ul >
< li class = "toctree-l3" >< a class = "reference internal" href = "writing-plugins.html#single-file-plugins" > Single file plugins</ a ></ li >
< li class = "toctree-l3" >< a class = "reference internal" href = "writing-plugins.html#module-plugins" > Module Plugins</ a ></ li >
</ ul >
</ li >
< li class = "toctree-l2" >< a class = "reference internal" href = "writing-plugins.html#writing-the-plugin" > Writing the plugin</ a >< ul >
< li class = "toctree-l3" >< a class = "reference internal" href = "writing-plugins.html#iplugin-interface" >< code class = "docutils literal notranslate" >< span class = "pre" > IPlugin</ span ></ code > interface</ a ></ li >
</ ul >
</ li >
2020-10-07 18:49:09 +00:00
< li class = "toctree-l2" >< a class = "reference internal" href = "writing-plugins.html#examples" > Examples</ a >< ul >
< li class = "toctree-l3" >< a class = "reference internal" href = "writing-plugins.html#tutorial-plugins" > Tutorial Plugins</ a ></ li >
< li class = "toctree-l3" >< a class = "reference internal" href = "writing-plugins.html#official-plugins" > Official Plugins</ a ></ li >
< li class = "toctree-l3" >< a class = "reference internal" href = "writing-plugins.html#unofficial-plugins" > Unofficial Plugins</ a ></ li >
</ ul >
</ li >
2021-02-06 18:58:42 +00:00
< li class = "toctree-l2" >< a class = "reference internal" href = "writing-plugins.html#internationalization" > Internationalization</ a >< ul >
< li class = "toctree-l3" >< a class = "reference internal" href = "writing-plugins.html#adding-translation-code" > Adding translation code</ a ></ li >
< li class = "toctree-l3" >< a class = "reference internal" href = "writing-plugins.html#generating-qt-translation-files" > Generating Qt translation files</ a ></ li >
< li class = "toctree-l3" >< a class = "reference internal" href = "writing-plugins.html#translating" > Translating</ a ></ li >
< li class = "toctree-l3" >< a class = "reference internal" href = "writing-plugins.html#distributing-translations" > Distributing translations</ a ></ li >
</ ul >
</ li >
2020-09-24 13:47:11 +00:00
</ ul >
</ li >
< li class = "toctree-l1 current" >< a class = "current reference internal" href = "#" > FAQ</ a >< ul >
< li class = "toctree-l2" >< a class = "reference internal" href = "#why-is-mo2-throwing-an-exception-when-i-try-to-create-a-type-inheriting-one-of-mo2-class" > 1. Why is MO2 throwing an exception when I try to create a type inheriting one of MO2 class?</ a ></ li >
< li class = "toctree-l2" >< a class = "reference internal" href = "#how-can-i-be-sure-to-implement-all-the-required-methods-when-creating-a-plugin" > 2. How can I be sure to implement all the required methods when creating a plugin?</ a ></ li >
< li class = "toctree-l2" >< a class = "reference internal" href = "#why-are-my-isinstance-x-qobject-and-isinstance-y-qwidget-not-working" > 3. Why are my < code class = "docutils literal notranslate" >< span class = "pre" > isinstance(x,</ span > < span class = "pre" > QObject)</ span ></ code > and < code class = "docutils literal notranslate" >< span class = "pre" > isinstance(y,</ span > < span class = "pre" > QWidget)</ span ></ code > not working?</ a ></ li >
</ ul >
</ li >
2024-08-09 08:57:44 +00:00
< li class = "toctree-l1" >< a class = "reference internal" href = "autoapi/index.html" > API Reference</ a >< ul >
< li class = "toctree-l2" >< a class = "reference internal" href = "autoapi/mobase/index.html" > mobase</ a >< ul >
2026-05-08 12:18:48 +00:00
< li class = "toctree-l3" >< a class = "reference internal" href = "autoapi/mobase/index.html#submodules" > Submodules</ a >< ul >
2024-08-09 08:57:44 +00:00
< li class = "toctree-l4" >< a class = "reference internal" href = "autoapi/mobase/widgets/index.html" > mobase.widgets</ a ></ li >
2023-09-20 17:06:52 +00:00
</ ul >
</ li >
2024-08-09 08:57:44 +00:00
< li class = "toctree-l3" >< a class = "reference internal" href = "autoapi/mobase/index.html#attributes" > Attributes</ a ></ li >
< li class = "toctree-l3" >< a class = "reference internal" href = "autoapi/mobase/index.html#classes" > Classes</ a ></ li >
< li class = "toctree-l3" >< a class = "reference internal" href = "autoapi/mobase/index.html#functions" > Functions</ a ></ li >
< li class = "toctree-l3" >< a class = "reference internal" href = "autoapi/mobase/index.html#package-contents" > Package Contents</ a >< ul >
< li class = "toctree-l4" >< a class = "reference internal" href = "autoapi/mobase/index.html#mobase.BSAInvalidation" >< code class = "docutils literal notranslate" >< span class = "pre" > BSAInvalidation</ span ></ code ></ a ></ li >
< li class = "toctree-l4" >< a class = "reference internal" href = "autoapi/mobase/index.html#mobase.DataArchives" >< code class = "docutils literal notranslate" >< span class = "pre" > DataArchives</ span ></ code ></ a ></ li >
< li class = "toctree-l4" >< a class = "reference internal" href = "autoapi/mobase/index.html#mobase.EndorsedState" >< code class = "docutils literal notranslate" >< span class = "pre" > EndorsedState</ span ></ code ></ a ></ li >
< li class = "toctree-l4" >< a class = "reference internal" href = "autoapi/mobase/index.html#mobase.ExecutableForcedLoadSetting" >< code class = "docutils literal notranslate" >< span class = "pre" > ExecutableForcedLoadSetting</ span ></ code ></ a ></ li >
< li class = "toctree-l4" >< a class = "reference internal" href = "autoapi/mobase/index.html#mobase.ExecutableInfo" >< code class = "docutils literal notranslate" >< span class = "pre" > ExecutableInfo</ span ></ code ></ a ></ li >
< li class = "toctree-l4" >< a class = "reference internal" href = "autoapi/mobase/index.html#mobase.FileInfo" >< code class = "docutils literal notranslate" >< span class = "pre" > FileInfo</ span ></ code ></ a ></ li >
< li class = "toctree-l4" >< a class = "reference internal" href = "autoapi/mobase/index.html#mobase.FileTreeEntry" >< code class = "docutils literal notranslate" >< span class = "pre" > FileTreeEntry</ span ></ code ></ a ></ li >
< li class = "toctree-l4" >< a class = "reference internal" href = "autoapi/mobase/index.html#mobase.GameFeature" >< code class = "docutils literal notranslate" >< span class = "pre" > GameFeature</ span ></ code ></ a ></ li >
< li class = "toctree-l4" >< a class = "reference internal" href = "autoapi/mobase/index.html#mobase.GamePlugins" >< code class = "docutils literal notranslate" >< span class = "pre" > GamePlugins</ span ></ code ></ a ></ li >
< li class = "toctree-l4" >< a class = "reference internal" href = "autoapi/mobase/index.html#mobase.GuessQuality" >< code class = "docutils literal notranslate" >< span class = "pre" > GuessQuality</ span ></ code ></ a ></ li >
< li class = "toctree-l4" >< a class = "reference internal" href = "autoapi/mobase/index.html#mobase.GuessedString" >< code class = "docutils literal notranslate" >< span class = "pre" > GuessedString</ span ></ code ></ a ></ li >
< li class = "toctree-l4" >< a class = "reference internal" href = "autoapi/mobase/index.html#mobase.IDownloadManager" >< code class = "docutils literal notranslate" >< span class = "pre" > IDownloadManager</ span ></ code ></ a ></ li >
< li class = "toctree-l4" >< a class = "reference internal" href = "autoapi/mobase/index.html#mobase.IFileTree" >< code class = "docutils literal notranslate" >< span class = "pre" > IFileTree</ span ></ code ></ a ></ li >
< li class = "toctree-l4" >< a class = "reference internal" href = "autoapi/mobase/index.html#mobase.IGameFeatures" >< code class = "docutils literal notranslate" >< span class = "pre" > IGameFeatures</ span ></ code ></ a ></ li >
< li class = "toctree-l4" >< a class = "reference internal" href = "autoapi/mobase/index.html#mobase.IInstallationManager" >< code class = "docutils literal notranslate" >< span class = "pre" > IInstallationManager</ span ></ code ></ a ></ li >
< li class = "toctree-l4" >< a class = "reference internal" href = "autoapi/mobase/index.html#mobase.IModInterface" >< code class = "docutils literal notranslate" >< span class = "pre" > IModInterface</ span ></ code ></ a ></ li >
< li class = "toctree-l4" >< a class = "reference internal" href = "autoapi/mobase/index.html#mobase.IModList" >< code class = "docutils literal notranslate" >< span class = "pre" > IModList</ span ></ code ></ a ></ li >
< li class = "toctree-l4" >< a class = "reference internal" href = "autoapi/mobase/index.html#mobase.IModRepositoryBridge" >< code class = "docutils literal notranslate" >< span class = "pre" > IModRepositoryBridge</ span ></ code ></ a ></ li >
< li class = "toctree-l4" >< a class = "reference internal" href = "autoapi/mobase/index.html#mobase.IOrganizer" >< code class = "docutils literal notranslate" >< span class = "pre" > IOrganizer</ span ></ code ></ a ></ li >
< li class = "toctree-l4" >< a class = "reference internal" href = "autoapi/mobase/index.html#mobase.IPlugin" >< code class = "docutils literal notranslate" >< span class = "pre" > IPlugin</ span ></ code ></ a ></ li >
< li class = "toctree-l4" >< a class = "reference internal" href = "autoapi/mobase/index.html#mobase.IPluginDiagnose" >< code class = "docutils literal notranslate" >< span class = "pre" > IPluginDiagnose</ span ></ code ></ a ></ li >
< li class = "toctree-l4" >< a class = "reference internal" href = "autoapi/mobase/index.html#mobase.IPluginFileMapper" >< code class = "docutils literal notranslate" >< span class = "pre" > IPluginFileMapper</ span ></ code ></ a ></ li >
< li class = "toctree-l4" >< a class = "reference internal" href = "autoapi/mobase/index.html#mobase.IPluginGame" >< code class = "docutils literal notranslate" >< span class = "pre" > IPluginGame</ span ></ code ></ a ></ li >
< li class = "toctree-l4" >< a class = "reference internal" href = "autoapi/mobase/index.html#mobase.IPluginInstaller" >< code class = "docutils literal notranslate" >< span class = "pre" > IPluginInstaller</ span ></ code ></ a ></ li >
< li class = "toctree-l4" >< a class = "reference internal" href = "autoapi/mobase/index.html#mobase.IPluginInstallerCustom" >< code class = "docutils literal notranslate" >< span class = "pre" > IPluginInstallerCustom</ span ></ code ></ a ></ li >
< li class = "toctree-l4" >< a class = "reference internal" href = "autoapi/mobase/index.html#mobase.IPluginInstallerSimple" >< code class = "docutils literal notranslate" >< span class = "pre" > IPluginInstallerSimple</ span ></ code ></ a ></ li >
< li class = "toctree-l4" >< a class = "reference internal" href = "autoapi/mobase/index.html#mobase.IPluginList" >< code class = "docutils literal notranslate" >< span class = "pre" > IPluginList</ span ></ code ></ a ></ li >
< li class = "toctree-l4" >< a class = "reference internal" href = "autoapi/mobase/index.html#mobase.IPluginModPage" >< code class = "docutils literal notranslate" >< span class = "pre" > IPluginModPage</ span ></ code ></ a ></ li >
< li class = "toctree-l4" >< a class = "reference internal" href = "autoapi/mobase/index.html#mobase.IPluginPreview" >< code class = "docutils literal notranslate" >< span class = "pre" > IPluginPreview</ span ></ code ></ a ></ li >
< li class = "toctree-l4" >< a class = "reference internal" href = "autoapi/mobase/index.html#mobase.IPluginRequirement" >< code class = "docutils literal notranslate" >< span class = "pre" > IPluginRequirement</ span ></ code ></ a ></ li >
< li class = "toctree-l4" >< a class = "reference internal" href = "autoapi/mobase/index.html#mobase.IPluginTool" >< code class = "docutils literal notranslate" >< span class = "pre" > IPluginTool</ span ></ code ></ a ></ li >
< li class = "toctree-l4" >< a class = "reference internal" href = "autoapi/mobase/index.html#mobase.IProfile" >< code class = "docutils literal notranslate" >< span class = "pre" > IProfile</ span ></ code ></ a ></ li >
< li class = "toctree-l4" >< a class = "reference internal" href = "autoapi/mobase/index.html#mobase.ISaveGame" >< code class = "docutils literal notranslate" >< span class = "pre" > ISaveGame</ span ></ code ></ a ></ li >
< li class = "toctree-l4" >< a class = "reference internal" href = "autoapi/mobase/index.html#mobase.ISaveGameInfoWidget" >< code class = "docutils literal notranslate" >< span class = "pre" > ISaveGameInfoWidget</ span ></ code ></ a ></ li >
< li class = "toctree-l4" >< a class = "reference internal" href = "autoapi/mobase/index.html#mobase.InstallResult" >< code class = "docutils literal notranslate" >< span class = "pre" > InstallResult</ span ></ code ></ a ></ li >
< li class = "toctree-l4" >< a class = "reference internal" href = "autoapi/mobase/index.html#mobase.LoadOrderMechanism" >< code class = "docutils literal notranslate" >< span class = "pre" > LoadOrderMechanism</ span ></ code ></ a ></ li >
< li class = "toctree-l4" >< a class = "reference internal" href = "autoapi/mobase/index.html#mobase.LocalSavegames" >< code class = "docutils literal notranslate" >< span class = "pre" > LocalSavegames</ span ></ code ></ a ></ li >
< li class = "toctree-l4" >< a class = "reference internal" href = "autoapi/mobase/index.html#mobase.Mapping" >< code class = "docutils literal notranslate" >< span class = "pre" > Mapping</ span ></ code ></ a ></ li >
< li class = "toctree-l4" >< a class = "reference internal" href = "autoapi/mobase/index.html#mobase.ModDataChecker" >< code class = "docutils literal notranslate" >< span class = "pre" > ModDataChecker</ span ></ code ></ a ></ li >
< li class = "toctree-l4" >< a class = "reference internal" href = "autoapi/mobase/index.html#mobase.ModDataContent" >< code class = "docutils literal notranslate" >< span class = "pre" > ModDataContent</ span ></ code ></ a ></ li >
< li class = "toctree-l4" >< a class = "reference internal" href = "autoapi/mobase/index.html#mobase.ModRepositoryFileInfo" >< code class = "docutils literal notranslate" >< span class = "pre" > ModRepositoryFileInfo</ span ></ code ></ a ></ li >
< li class = "toctree-l4" >< a class = "reference internal" href = "autoapi/mobase/index.html#mobase.ModState" >< code class = "docutils literal notranslate" >< span class = "pre" > ModState</ span ></ code ></ a ></ li >
< li class = "toctree-l4" >< a class = "reference internal" href = "autoapi/mobase/index.html#mobase.PluginRequirementFactory" >< code class = "docutils literal notranslate" >< span class = "pre" > PluginRequirementFactory</ span ></ code ></ a ></ li >
< li class = "toctree-l4" >< a class = "reference internal" href = "autoapi/mobase/index.html#mobase.PluginSetting" >< code class = "docutils literal notranslate" >< span class = "pre" > PluginSetting</ span ></ code ></ a ></ li >
< li class = "toctree-l4" >< a class = "reference internal" href = "autoapi/mobase/index.html#mobase.PluginState" >< code class = "docutils literal notranslate" >< span class = "pre" > PluginState</ span ></ code ></ a ></ li >
< li class = "toctree-l4" >< a class = "reference internal" href = "autoapi/mobase/index.html#mobase.ProfileSetting" >< code class = "docutils literal notranslate" >< span class = "pre" > ProfileSetting</ span ></ code ></ a ></ li >
< li class = "toctree-l4" >< a class = "reference internal" href = "autoapi/mobase/index.html#mobase.ReleaseType" >< code class = "docutils literal notranslate" >< span class = "pre" > ReleaseType</ span ></ code ></ a ></ li >
< li class = "toctree-l4" >< a class = "reference internal" href = "autoapi/mobase/index.html#mobase.SaveGameInfo" >< code class = "docutils literal notranslate" >< span class = "pre" > SaveGameInfo</ span ></ code ></ a ></ li >
< li class = "toctree-l4" >< a class = "reference internal" href = "autoapi/mobase/index.html#mobase.ScriptExtender" >< code class = "docutils literal notranslate" >< span class = "pre" > ScriptExtender</ span ></ code ></ a ></ li >
< li class = "toctree-l4" >< a class = "reference internal" href = "autoapi/mobase/index.html#mobase.SortMechanism" >< code class = "docutils literal notranslate" >< span class = "pre" > SortMechanism</ span ></ code ></ a ></ li >
< li class = "toctree-l4" >< a class = "reference internal" href = "autoapi/mobase/index.html#mobase.TrackedState" >< code class = "docutils literal notranslate" >< span class = "pre" > TrackedState</ span ></ code ></ a ></ li >
< li class = "toctree-l4" >< a class = "reference internal" href = "autoapi/mobase/index.html#mobase.UnmanagedMods" >< code class = "docutils literal notranslate" >< span class = "pre" > UnmanagedMods</ span ></ code ></ a ></ li >
< li class = "toctree-l4" >< a class = "reference internal" href = "autoapi/mobase/index.html#mobase.VersionInfo" >< code class = "docutils literal notranslate" >< span class = "pre" > VersionInfo</ span ></ code ></ a ></ li >
< li class = "toctree-l4" >< a class = "reference internal" href = "autoapi/mobase/index.html#mobase.VersionScheme" >< code class = "docutils literal notranslate" >< span class = "pre" > VersionScheme</ span ></ code ></ a ></ li >
< li class = "toctree-l4" >< a class = "reference internal" href = "autoapi/mobase/index.html#mobase.getFileVersion" >< code class = "docutils literal notranslate" >< span class = "pre" > getFileVersion()</ span ></ code ></ a ></ li >
< li class = "toctree-l4" >< a class = "reference internal" href = "autoapi/mobase/index.html#mobase.getIconForExecutable" >< code class = "docutils literal notranslate" >< span class = "pre" > getIconForExecutable()</ span ></ code ></ a ></ li >
< li class = "toctree-l4" >< a class = "reference internal" href = "autoapi/mobase/index.html#mobase.getProductVersion" >< code class = "docutils literal notranslate" >< span class = "pre" > getProductVersion()</ span ></ code ></ a ></ li >
< li class = "toctree-l4" >< a class = "reference internal" href = "autoapi/mobase/index.html#mobase.GameFeatureType" >< code class = "docutils literal notranslate" >< span class = "pre" > GameFeatureType</ span ></ code ></ a ></ li >
< li class = "toctree-l4" >< a class = "reference internal" href = "autoapi/mobase/index.html#mobase.INVALID_HANDLE_VALUE" >< code class = "docutils literal notranslate" >< span class = "pre" > INVALID_HANDLE_VALUE</ span ></ code ></ a ></ li >
< li class = "toctree-l4" >< a class = "reference internal" href = "autoapi/mobase/index.html#mobase.MoVariant" >< code class = "docutils literal notranslate" >< span class = "pre" > MoVariant</ span ></ code ></ a ></ li >
< li class = "toctree-l4" >< a class = "reference internal" href = "autoapi/mobase/index.html#mobase.__version__" >< code class = "docutils literal notranslate" >< span class = "pre" > __version__</ span ></ code ></ a ></ li >
2023-09-20 17:06:52 +00:00
</ ul >
</ li >
2020-09-24 13:47:11 +00:00
</ ul >
</ li >
</ ul >
</ li >
</ ul >
</ div >
</ div >
</ nav >
2023-09-20 17:06:52 +00:00
< section data-toggle = "wy-nav-shift" class = "wy-nav-content-wrap" >< nav class = "wy-nav-top" aria-label = "Mobile navigation menu" >
2020-09-24 13:47:11 +00:00
< i data-toggle = "wy-nav-top" class = "fa fa-bars" ></ i >
< a href = "index.html" > MO2 Python Plugin API</ a >
</ nav >
< div class = "wy-nav-content" >
< div class = "rst-content" >
2023-09-20 17:06:52 +00:00
< div role = "navigation" aria-label = "Page navigation" >
2020-09-24 13:47:11 +00:00
< ul class = "wy-breadcrumbs" >
2023-09-20 17:06:52 +00:00
< li >< a href = "index.html" class = "icon icon-home" aria-label = "Home" ></ a ></ li >
< li class = "breadcrumb-item active" > FAQ</ li >
2020-09-24 13:47:11 +00:00
< li class = "wy-breadcrumbs-aside" >
< a href = "_sources/faq.rst.txt" rel = "nofollow" > View page source</ a >
</ li >
</ ul >
< hr />
</ div >
< div role = "main" class = "document" itemscope = "itemscope" itemtype = "http://schema.org/Article" >
< div itemprop = "articleBody" >
2023-09-20 17:06:52 +00:00
< section id = "faq" >
< h1 > FAQ< a class = "headerlink" href = "#faq" title = "Link to this heading" > </ a ></ h1 >
2020-09-24 13:47:11 +00:00
< div class = "toctree-wrapper compound" >
</ div >
2023-09-20 17:06:52 +00:00
< section id = "why-is-mo2-throwing-an-exception-when-i-try-to-create-a-type-inheriting-one-of-mo2-class" >
< h2 > 1. Why is MO2 throwing an exception when I try to create a type inheriting one of MO2 class?< a class = "headerlink" href = "#why-is-mo2-throwing-an-exception-when-i-try-to-create-a-type-inheriting-one-of-mo2-class" title = "Link to this heading" > </ a ></ h2 >
2020-09-24 13:47:11 +00:00
< p > This often happens if you forget to call < code class = "docutils literal notranslate" >< span class = "pre" > super().__init__()</ span ></ code > with the right arguments.
Even if the list of arguments is empty (as in the example), it must be called due to a “bug”
in < code class = "docutils literal notranslate" >< span class = "pre" > boost::python</ span ></ code > :</ p >
2026-05-08 12:18:48 +00:00
< div class = "highlight-python notranslate" >< div class = "highlight" >< pre >< span ></ span >< span class = "k" > class</ span >< span class = "w" > </ span >< span class = "nc" > MySaveGame</ span >< span class = "p" > (</ span >< span class = "n" > mobase</ span >< span class = "o" > .</ span >< span class = "n" > ISaveGame</ span >< span class = "p" > ):</ span >
< span class = "k" > def</ span >< span class = "w" > </ span >< span class = "fm" > __init__</ span >< span class = "p" > (</ span >< span class = "bp" > self</ span >< span class = "p" > ):</ span >
2020-09-24 13:47:11 +00:00
< span class = "nb" > super</ span >< span class = "p" > ()</ span >< span class = "o" > .</ span >< span class = "fm" > __init__</ span >< span class = "p" > ()</ span > < span class = "c1" > # Mandatory!</ span >
</ pre ></ div >
</ div >
2023-09-20 17:06:52 +00:00
</ section >
< section id = "how-can-i-be-sure-to-implement-all-the-required-methods-when-creating-a-plugin" >
< h2 > 2. How can I be sure to implement all the required methods when creating a plugin?< a class = "headerlink" href = "#how-can-i-be-sure-to-implement-all-the-required-methods-when-creating-a-plugin" title = "Link to this heading" > </ a ></ h2 >
2020-09-24 13:47:11 +00:00
< p > It is kind of annoying to create a MO2 python plugin that kind of works and have it crash
at some point simply because there plugin is missing a function implementation.
You can have < code class = "docutils literal notranslate" >< span class = "pre" > mypy</ span ></ code > warn you for such issue by typing the < code class = "docutils literal notranslate" >< span class = "pre" > createPlugin</ span ></ code > or < code class = "docutils literal notranslate" >< span class = "pre" > createPlugins</ span ></ code >
functions:</ p >
2026-05-08 12:18:48 +00:00
< div class = "highlight-python notranslate" >< div class = "highlight" >< pre >< span ></ span >< span class = "kn" > import</ span >< span class = "w" > </ span >< span class = "nn" > typing</ span >
2020-09-24 13:47:11 +00:00
< span class = "c1" > # A plugin that is missing something (e.g. display()).</ span >
2026-05-08 12:18:48 +00:00
< span class = "k" > class</ span >< span class = "w" > </ span >< span class = "nc" > MyPlugin</ span >< span class = "p" > (</ span >< span class = "n" > mobase</ span >< span class = "o" > .</ span >< span class = "n" > IPluginTool</ span >< span class = "p" > ):</ span > < span class = "o" > ...</ span >
2020-09-24 13:47:11 +00:00
< span class = "c1" > # If you type-hint `createPlugin` by adding `-> mobase.IPlugin`,</ span >
< span class = "c1" > # `mypy` will warn you that `MyPlugin` is an incomplete class.</ span >
2026-05-08 12:18:48 +00:00
< span class = "k" > def</ span >< span class = "w" > </ span >< span class = "nf" > createPlugin</ span >< span class = "p" > ()</ span > < span class = "o" > -> </ span > < span class = "n" > mobase</ span >< span class = "o" > .</ span >< span class = "n" > IPlugin</ span >< span class = "p" > :</ span >
2020-09-24 13:47:11 +00:00
< span class = "k" > return</ span > < span class = "n" > MyPlugin</ span >< span class = "p" > ()</ span >
< span class = "c1" > # You can also type-hint `createPlugins`:</ span >
2026-05-08 12:18:48 +00:00
< span class = "k" > def</ span >< span class = "w" > </ span >< span class = "nf" > createPlugins</ span >< span class = "p" > ()</ span > < span class = "o" > -> </ span > < span class = "n" > typing</ span >< span class = "o" > .</ span >< span class = "n" > List</ span >< span class = "p" > [</ span >< span class = "n" > mobase</ span >< span class = "o" > .</ span >< span class = "n" > IPlugin</ span >< span class = "p" > ]:</ span >
2020-09-24 13:47:11 +00:00
< span class = "k" > return</ span > < span class = "p" > [</ span >< span class = "n" > MyPlugin</ span >< span class = "p" > ()]</ span >
</ pre ></ div >
</ div >
2023-09-20 17:06:52 +00:00
</ section >
< section id = "why-are-my-isinstance-x-qobject-and-isinstance-y-qwidget-not-working" >
< h2 > 3. Why are my < code class = "docutils literal notranslate" >< span class = "pre" > isinstance(x,</ span > < span class = "pre" > QObject)</ span ></ code > and < code class = "docutils literal notranslate" >< span class = "pre" > isinstance(y,</ span > < span class = "pre" > QWidget)</ span ></ code > not working?< a class = "headerlink" href = "#why-are-my-isinstance-x-qobject-and-isinstance-y-qwidget-not-working" title = "Link to this heading" > </ a ></ h2 >
2020-09-24 13:47:11 +00:00
< p > Some classes from < code class = "docutils literal notranslate" >< span class = "pre" > mobase</ span ></ code > are said to inherit < code class = "docutils literal notranslate" >< span class = "pre" > QObject</ span ></ code > and < code class = "docutils literal notranslate" >< span class = "pre" > QWidget</ span ></ code > in the
2024-08-09 08:57:44 +00:00
stubs, such as < a class = "reference internal" href = "autoapi/mobase/index.html#mobase.IDownloadManager" title = "mobase.IDownloadManager" >< code class = "xref py py-class docutils literal notranslate" >< span class = "pre" > mobase.IDownloadManager</ span ></ code ></ a > .
2020-09-24 13:47:11 +00:00
This is not the case in practice due to limitation in Python and < code class = "docutils literal notranslate" >< span class = "pre" > boost::python</ span ></ code > .
The bases are in the stubs to allow for auto-completion and typing, which is then
simulated in the real < code class = "docutils literal notranslate" >< span class = "pre" > mobase</ span ></ code > by overriding < code class = "docutils literal notranslate" >< span class = "pre" > __getattr__</ span ></ code > and delegating to
the underlying < code class = "docutils literal notranslate" >< span class = "pre" > QObject</ span ></ code > or < code class = "docutils literal notranslate" >< span class = "pre" > QWidget</ span ></ code > .</ p >
2023-09-20 17:06:52 +00:00
</ section >
</ section >
2020-09-24 13:47:11 +00:00
</ div >
</ div >
2023-09-20 17:06:52 +00:00
< footer >< div class = "rst-footer-buttons" role = "navigation" aria-label = "Footer" >
2021-01-18 21:09:43 +00:00
< a href = "writing-plugins.html" class = "btn btn-neutral float-left" title = "Writing Plugins" accesskey = "p" rel = "prev" >< span class = "fa fa-arrow-circle-left" aria-hidden = "true" ></ span > Previous</ a >
2024-08-09 08:57:44 +00:00
< a href = "autoapi/index.html" class = "btn btn-neutral float-right" title = "API Reference" accesskey = "n" rel = "next" > Next < span class = "fa fa-arrow-circle-right" aria-hidden = "true" ></ span ></ a >
2020-09-24 13:47:11 +00:00
</ div >
< hr />
< div role = "contentinfo" >
2023-09-20 17:06:52 +00:00
< p > © Copyright 2023, Holt59.</ p >
2020-09-24 13:47:11 +00:00
</ div >
2023-09-20 17:06:52 +00:00
Built with < a href = "https://www.sphinx-doc.org/" > Sphinx</ a > using a
2021-01-18 21:09:43 +00:00
< a href = "https://github.com/readthedocs/sphinx_rtd_theme" > theme</ a >
2023-09-20 17:06:52 +00:00
provided by < a href = "https://readthedocs.org" > Read the Docs</ a > .
2020-09-24 13:47:11 +00:00
</ footer >
</ div >
</ div >
</ section >
</ div >
2023-09-20 17:06:52 +00:00
< script >
2020-09-24 13:47:11 +00:00
jQuery ( function () {
SphinxRtdTheme . Navigation . enable ( true );
});
2023-09-20 17:06:52 +00:00
</ script >
2020-09-24 13:47:11 +00:00
</ body >
</ html >