Dynamicznie importuj metodę w pliku, z ciągu

Mam ciąg, powiedzieć: abc.def.ghi.jkl.myfile.mymethod. Jak dynamicznie importować mymethod? Oto jak to zrobiłem: def get_method_from_file(full_path): if len(full_path) == 1: return map(__import__,[full_path[0]])[0] return getattr(get_method_from_file(full_path[:-1]),full_path[-1]) if...