On Mon, 03 Oct 2011 03:21:41 +0100, Andrew Berg
wrote:
I found a way to do it, albeit a very hackish one. Since the class
instance already catches exceptions from the modules it imports, I can
make a custom exception (in a common area for both it and the submodules
to import) for it to catch
I found a way to do it, albeit a very hackish one. Since the class
instance already catches exceptions from the modules it imports, I can
make a custom exception (in a common area for both it and the submodules
to import) for it to catch and have it call its own methods there based
on information s
On Sun, 02 Oct 2011 06:12:05 +0100, Andrew Berg
wrote:
I'm not sure the subject's wording is the best, but I'll try to explain.
I have a main script that imports several modules and I need to be able
to call methods from a class instance inside that main script from a
module.
Do you mean th
Andrew Berg wrote:
> On 2011.10.02 01:55 AM, Steven D'Aprano wrote:
>> Have I missed something? Why can't you just import the module and call
>> the methods like you would for any other module and class?
>>
>> import module
>> instance = module.Some_Class()
>> result = instance.method(some, argum
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,
On 2011.10.02 01:55 AM, Steven D'Aprano wrote:
> Have I missed something? Why can't you just import the module and call the
> methods like you would for any other module and class?
>
> import module
> instance = module.Some_Class()
> result = instance.method(some, arguments, may, be, needed)
I nee
Andrew Berg wrote:
> I'm not sure the subject's wording is the best, but I'll try to explain.
> I have a main script that imports several modules and I need to be able
> to call methods from a class instance inside that main script from a
> module. Currently, functions can be defined to access the
I'm not sure the subject's wording is the best, but I'll try to explain.
I have a main script that imports several modules and I need to be able
to call methods from a class instance inside that main script from a
module. Currently, functions can be defined to access the methods, but
such functions