Fix double loading plugins and sys.path entires multiplying

This commit is contained in:
qu1ck 2022-02-16 22:28:00 -08:00 committed by jean-pierre charras
parent b9a834e600
commit b53b68c686
2 changed files with 3 additions and 2 deletions

View File

@ -67,7 +67,7 @@ bool SCRIPTING_TOOL::Init()
PyDict_SetItemString( sys_mod, "_pcbnew", mod );
Py_DECREF( mod );
callLoadPlugins();
// plugins will be loaded later via ReloadPlugins()
}
return true;

View File

@ -253,7 +253,8 @@ def LoadPlugins(bundlepath=None, userpath=None, thirdpartypath=None):
if not os.path.isdir( plugins_dir ):
continue
sys.path.append( plugins_dir )
if plugins_dir not in sys.path:
sys.path.append( plugins_dir )
for module in os.listdir(plugins_dir):
fullPath = os.path.join( plugins_dir, module )