Skip to content Skip to sidebar Skip to footer

How To Import Function From A Module Given Absolute Path?

from bar import foo allows one to import function foo from module bar, without importing the whole module. Now, this thread: Python 3.4: How to import a module given the full pat

Solution 1:

No, there is no such way.

That said...

from bar import foo 

Is also importing the whole module bar

it is like:

import bar
foo = bar.foo
delglobals['bar']

Post a Comment for "How To Import Function From A Module Given Absolute Path?"