private static object ImportModuleFrom(CodeContext /*!*/ context, object from, string[] parts, int current) { PythonModule scope = from as PythonModule; if (scope != null) { object path; List listPath; string stringPath; if (scope.__dict__._storage.TryGetPath(out path)) { if ((listPath = path as List) != null) { return(ImportNestedModule(context, scope, parts, current, listPath)); } else if ((stringPath = path as string) != null) { return(ImportNestedModule(context, scope, parts, current, List.FromArrayNoCopy(stringPath))); } } else { PythonType t = DynamicHelpers.GetPythonType(scope); if (t.TryGetMember(context, scope, "__path__", out path)) { if ((listPath = path as List) != null) { return(ImportNestedModule(context, scope, parts, current, listPath)); } else if ((stringPath = path as string) != null) { return(ImportNestedModule(context, scope, parts, current, List.FromArrayNoCopy(stringPath))); } } } } NamespaceTracker ns = from as NamespaceTracker; if (ns != null) { object val; if (ns.TryGetValue(parts[current], out val)) { return(MemberTrackerToPython(context, val)); } } throw PythonOps.ImportError("No module named {0}", parts[current]); }