Simple Python Import
Question: I have a simple Python import question. I have a module _(let's call it**A**)_
that is importing a module **B**. Module B imports a lot of other modules C,
D, E, F, etc. I want module A to be able to use the modules C, D, E, F, etc.
Is there an easy way to do this? I don't want to directly import C, D, E, F,
etc from A.

What I'm trying to accomplish is to provide an API to script developers, who
write module A. So, I wanted module A only to have to include module B which
is the main entry point to the API and imports all the modules in the API.


Answer: You could do...

    
    
    from B import *
    

...inside module A (although you need to make sure that there's nothing else
inside module B that has the same name with anything inside module A,
otherwise you'll have a namespace collision).

Once you do that, you could do...

    
    
    C.blah()
    D.testing.meh()
    

...inside module A, as usual.

Alternatively, a better solution would be to do something like the below in
module A:

    
    
    import B
    
    B.C.blah()
    B.D.testing.meh()
    

