+ else:
+ #try to find if sub is an attribute (eventually dotted) of m
+ components=sub.split('.')
+ has_submod=True
+ submod=m
+ for comp in components:
+ if hasattr(submod,comp):
+ submod=getattr(submod, comp)
+ else:
+ has_submod=False
+ break
+
+ if has_submod:
+ #the attribute has been found