Import a python module without the .py extension

Posted by compie on Stack Overflow See other posts from Stack Overflow or by compie
Published on 2010-04-08T15:11:21Z Indexed on 2010/04/08 15:23 UTC
Read the original article Hit count: 249

Filed under:
|

I have a file called foobar (without .py extension). In the same directory I have another python file that tries to import it:

import foobar

But this only works if I rename the file to foobar.py. Is it possible to import a python module that doesn't have the .py extension?

© Stack Overflow or respective owner

Related posts about python

Related posts about import