>> Why is this so difficult? >> Add a Graph class to the collections module (networkx is quite good) >> and simply check for circular imports. > > Er? That doesn't address the task of importing a module from a source > code file given its path on the filesystem.
That's true, I guess was hooked on Python's abstraction mechanism for making the file system invisible. But I like the idea of programming *relative* path addressing, so you can create a sort of "name space" for your modules. So instead of "import /path/to/file.py" which makes a system dependency (i.e. *yours*), you could have "import TestPackage.collections.bag" (using periods for file path separators in keeping with the Pythonic Way). -- MarkJ Tacoma, Washington -- https://mail.python.org/mailman/listinfo/python-list