I have a function defined in file f1.py
as:
def fn1():
return 1
def fn2():
return 2
For learning exercise I am trying the following, which works:
import f1
from f1 import fn1, fn2
But the following approach doesn't work:
pkgName = 'f1'
fnName = 'fn1'
from pkgName import fnName
How can I pass package name and function name as variable?