Re: [Tutor] How Do I Make Imports Work

2007-12-27 Thread Chris Fuller
On Thursday 27 December 2007 08:29, [EMAIL PROTECTED] wrote: > > e = Elevator() > e.show_state() > > raw_input("\n\nPress the enter key to exit.") > Two observations: This "module-level" code that does the testing will be run when the module is imported. A more flexible approach would be to pla

Re: [Tutor] How Do I Make Imports Work

2007-12-27 Thread Alan Gauld
<[EMAIL PROTECTED]> wrote > I am just starting to learn about making classes, so I wanted to put > some > code into a module and use it. Good idea. > move it into its own file and try to use an import statement to > bring it > in, I get errors that say that methods don't exist. Are you remem

Re: [Tutor] How Do I Make Imports Work

2007-12-27 Thread bob gailer
[EMAIL PROTECTED] wrote: > Hi, > Here is the offending code and error. > > # elevator_system.py > # By Jim Homme > # Simulate the behavior of a group of elevators. > # Try to import and get error. > # The module and this file are in the same directory. > import elevator > # The elevator module > #

Re: [Tutor] How Do I Make Imports Work

2007-12-27 Thread james . homme
Hi, Here is the offending code and error. # elevator_system.py # By Jim Homme # Simulate the behavior of a group of elevators. # Try to import and get error. # The module and this file are in the same directory. import elevator # The elevator module # This would be in a separate file. # When I rem

Re: [Tutor] How Do I Make Imports Work

2007-12-27 Thread Rob Andrews
Can you show us an example of the code where you're attempting to import and the error you get? -Rob A. On Dec 27, 2007 7:40 AM, <[EMAIL PROTECTED]> wrote: > > Hi, > I am just starting to learn about making classes, so I wanted to put some > code into a module and use it. I know the code works b

[Tutor] How Do I Make Imports Work

2007-12-27 Thread james . homme
Hi, I am just starting to learn about making classes, so I wanted to put some code into a module and use it. I know the code works because when I put it in the same file that calls it, it does what it's supposed to do. When I move it into its own file and try to use an import statement to bring it