+ 3
How can I import a module from another directory?
I am just working on a program.So I made different directory. File/Main.py File/Bin/func.py I tried to import func to main just like this way.. import os os.chndir("D:/Programs/Files/Bin") import func But It showes error.. How can I solve it..
2 Answers
+ 11
try putting a r before the string
like:
dstring=r"D:/Whatever/FoxPictures/fox.py"
that might not fix it, but I've had problems like it in the past where that's the solution
+ 1
should i try
import os
os.chdir("D:/Programs/Files")
from Files import func.py