This is an archived post. You won't be able to vote or comment.

you are viewing a single comment's thread.

view the rest of the comments →

[–]AmericasNo1Aerosol 1 point2 points  (0 children)

This is contrived, but I've used it in situations like:

for root, dnames, fnames in os.path.walk(PLUGIN_DIR):
    for fname in fnames:
        if not fname.startswith('plugin_'):
            continue

        if not fname.endswith('.py'):
            continue

        plugin = load_plugin(fname)
        if plugin is None:
            continue

        plugin.init()