[Tutor] module import problems
steve at pearwood.info
Mon Apr 26 05:09:51 CEST 2010
On Mon, 26 Apr 2010 11:56:06 am Rayon wrote:
> I have a module with the name _table
> in the same directory I have another by the name of _module
> I would like to import _table into _module
> can someone tall me how.
At the beginning of the _module module (what a name! yuck! don't you
have a more descriptive name you can use?), put this line:
Then whenever you need something from _table, you write something like
> from tables.report_db_engine import *
What is "tables"? Is that the same as _table?
Generally you shouldn't use the "from module import *" form. You should
consider it advanced usage, or at least discouraged.
More information about the Tutor