简体   繁体   中英

Importing a whole python hierarchy dynamically

I have written my own python code, organized in dirs and sub dirs hierarchy

I'm trying to use this code (package/module, I'm not sure about the terminology) in a few projects.

The issue is that the code path differes between the projects.

How can I import the whole dirs, subdirs and sub files hierarchy in each project?

Thanks in advance!

try this with your code before the import statements

from sys import path
path += [<path>] # Here You specify the path of the library package

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM