>>> import_path('os.path.join')
<function join at 0x22d4050>
What is the simplest way to write import_path (in Python 2.6 and above)? Assume that the last component is always a callable in a module/package.
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Please briefly explain why you feel this question should be reported.
Please briefly explain why you feel this answer should be reported.
Please briefly explain why you feel this user should be reported.
This seems to be what you want:
To make it work with Python 2.5 and earlier, where
__import__doesn’t take keyword arguments, you will need to use: