Thinking Modular

Greets

Well since of Python's strong points,is the ability to make modules to be imported into other programs at a later date,I've decided to try my hand at it.But being a non-programmer,I am having trouble implenting it.for example,lets say have some lists:

Code:

lista=['some', 'words', 'here']
listb=['other', 'different', 'stuff']

now when I define those lists inside my program,I am able to reffer to them w/o trouble.But what if I need the lists to be defined outside my program,and then imported at start up?example:

But I get an error saying lista is not defined.I know it's importing the right file(or atleast trying to) because when I do a "print database" it returns the filepath to my database module.The examples I have found on modules,all deal with using functions in those modules.But my module doesn't have functions,its just a bunch of lists that I need to reffer to.

Can anyone shed some light for me for,on how to use one of Pyhtons greatest strong points(making+using your own modules)?Or perhaps I need to use a dictionary?If so,can the dictionary be defined outside the main program,and them imported and used like I want?

It is not important if the glass is half full or half empty.What is important,is who has been drinking from MY glass?!?!?

Hi,
A module is a file which can contain variables, objects or other functions...any combination of these. Now when you create a module like database.py, it contains only lists... you can very well use it in other modules...like ur program.py.... provided you refer to the correct object...in simple words...it has to be module.variable or in case of functions... module.function() The advantage of this approach is that, your lista declared inside database.py won't clash with other lista declared in your program.py! Also it is an indication that lista belongs to this( database.py) module.

Good Boki,
But then the practice of using from module import * has been frowned upon....

When should you use from module import?

If you will be accessing attributes and methods often and don't want to type the module name over and over, use from module import.
If you want to selectively import some attributes and methods but not others, use from module import.
If the module contains attributes or functions with the same name as ones in your module, you must use import module to avoid name conflicts.

and read this one..............

Use from module import * sparingly, because it makes it difficult to determine where a particular function or attribute came from, and that makes debugging and refactoring more difficult.

As an analogy, you can overclock your PC to make it run faster, so why isn't
everyone doing it? Because it's likely to cause problems eventually, even if you
can get away with it for a while. Using "from module import *" won't fry your hardware, but it can end up costing a *lot* of wasted time tracking down bugs.

Forgive my terminology(or lack of hehe),but I misunderstood how import works.I thought once I imported a module,any variables I had defined inside would be available to use in the program that imported it...Just like as if I had defined those variables in the program itself.

Anyways,I guess I was over thinking it,but thx to NewPythoner for finding my simple mistake...Just had to tell Python what I was trying to reffer to properly.