non-standard module location (again)
Ian Kelly
ian.g.kelly at gmail.com
Fri Oct 21 11:48:21 EDT 2011
More information about the Python-list mailing list
Fri Oct 21 11:48:21 EDT 2011
- Previous message (by thread): non-standard module location (again)
- Next message (by thread): non-standard module location (again)
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
On Fri, Oct 21, 2011 at 8:05 AM, Shane <gshanemiller at verizon.net> wrote: > Need to refine a question I asked earlier. If I have a module, > > |-- foo > |-------| > |-------|---bar > |-------|-------| > |-------|-------|---__init__.py > > then I can say import foo.bar > > But suppose I want to import foo.bar.stuff and stuff isn't located on > under `bar' because it's user > supplied code: > > |- stuff <- I want this to be logically > under foo.bar > |-------|---__init__.py <- even though it's not under bar in > the computer's file system > > Now what: how to arrange to do command: import foo.bar.stuff I've never tried this myself, but I think that pkgutil.extend_path is what you're looking for. http://docs.python.org/library/pkgutil.html Cheers, Ian
- Previous message (by thread): non-standard module location (again)
- Next message (by thread): non-standard module location (again)
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
More information about the Python-list mailing list