/// <summary> /// Loads any extension DLLs present in sys.prefix\DLLs directory and adds references to them. /// /// This provides an easy drop-in location for .NET assemblies which should be automatically referenced /// (exposed via import), COM libraries, and pre-compiled Python code. /// </summary> private void InitializeExtensionDLLs() { string dir = Path.Combine(PythonContext.InitialPrefix, "DLLs"); if (Directory.Exists(dir)) { foreach (string file in Directory.EnumerateFiles(dir, "*.dll")) { if (file.ToLower().EndsWith(".dll")) { try { ClrModule.AddReferenceToFile(PythonContext.SharedContext, new FileInfo(file).Name); } catch { } } } } }