xxx222 xxx222 - 3 months ago 5x
Python Question

How to call functions in python files that are not in the working directory?

Say now my working folder is

and my supporting python files are in
, I want to call a function
in the
file under
, what should I do? I tried calling
from supporting_files.a import func
and that does not work. How am I suppose to do that without changing the actual working directory?


Add an file (it can be empty) to the supporting_files directory, and python will treat it as a package available for imports. More details are available in the Python documentation.