internal static PythonModule TryImportSourceFile(PythonContext /*!*/ context, string /*!*/ name) { var sourceUnit = TryFindSourceFile(context, name); PlatformAdaptationLayer pal = context.DomainManager.Platform; if (sourceUnit == null || GetFullPathAndValidateCase(context, pal.CombinePaths(pal.GetDirectoryName(sourceUnit.Path), name + pal.GetExtension(sourceUnit.Path)), false) == null) { return(null); } var scope = ExecuteSourceUnit(context, sourceUnit); if (sourceUnit.LanguageContext != context) { // foreign language, we should publish in sys.modules too context.SystemStateModules[name] = scope; } PythonOps.ScopeSetMember(context.SharedContext, sourceUnit.LanguageContext.DomainManager.Globals, name, scope); return(scope); }