On 2011.10.02 02:11 AM, Gary Herron wrote: > You may be able to do the simplest thing: If a module wants to call > something form the main module (or main script as you call it) just try > importing that main script and call whatever it is you want. This > results in a circular set of imports, but Python can often deal with > those without trouble. (Not always, so circular imports are best > avoided in general, but .. try it and see.) It doesn't work. I get an AttributeError any time I try to access the class instance from the sub-module. Even moving the load() call outside __init__() doesn't change this.
> If there is code in the main script (module) that needs to be called > form elsewhere, take it out of the main module and put it in a separate > module. Then import that new module both in the main script, and the > various sub-modules. This is cleaner than the circular imports in the > previous solution. I need to affect a specific instance which imports the sub-modules. I worded the subject line wrong (and I've no clue how to word it now). This is quite hard to explain, and I don't think it's easy to understand without really examining the code (I don't even fully understand it). More ideas are certainly welcome, but I think I'll have to ask the developer (who has only been somewhat active lately). -- CPython 3.2.2 | Windows NT 6.1.7601.17640 | Thunderbird 7.0 -- http://mail.python.org/mailman/listinfo/python-list