function - import modules from folder (Python) -
i have python file "a.py", folder named folder , in folder has "b.py".
a.py has code:
from folder.b import * function()
it says:
nameerror: name 'function' not defined
it defined.
why? thank you!
do have use folder.b
? if not: can add folder name folder
system path:
import sys sys.path.append(your_folder_containing_b.py)
and change a.py to:
from b import *
a less straight forward way change current working directory folder
, from b import *
import os os.chdir(your_folder_containing_b.py)
Comments
Post a Comment