Path: csiph.com!x330-a1.tempe.blueboxinc.net!usenet.pasdenom.info!aioe.org!feeder.news-service.com!newsfeed.xs4all.nl!newsfeed6.news.xs4all.nl!xs4all!post.news.xs4all.nl!not-for-mail Return-Path: X-Original-To: python-list@python.org Delivered-To: python-list@mail.python.org X-Spam-Status: OK 0.025 X-Spam-Evidence: '*H*': 0.95; '*S*': 0.00; 'subject:Python': 0.06; 'imports': 0.07; '"import': 0.16; 'subject:instance': 0.16; 'this:': 0.16; 'wrote:': 0.16; '>>>': 0.18; 'to:2**1': 0.20; 'header:In-Reply-To:1': 0.22; 'module,': 0.23; 'statement': 0.25; 'import': 0.28; 'example': 0.30; 'module': 0.30; 'solved': 0.30; 'thanks': 0.30; 'class': 0.30; 'list': 0.32; 'to:addr:python- list': 0.33; 'calling': 0.33; 'header:User-Agent:1': 0.34; 'object': 0.35; 'anything': 0.36; 'thread': 0.37; 'subject:: ': 0.39; 'received:192': 0.39; 'under': 0.39; 'to:addr:python.org': 0.39; 'subject:class': 0.84; 'titled': 0.84 Date: Tue, 06 Sep 2011 16:18:32 +0200 From: Laszlo Nagy User-Agent: Mozilla/5.0 (X11; U; Linux x86_64; en-US; rv:1.9.2.21) Gecko/20110831 Thunderbird/3.1.13 MIME-Version: 1.0 To: Kayode Odeyemi , python-list@python.org Subject: Re: Python marks an instance of my class undefined References: In-Reply-To: Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit X-BeenThere: python-list@python.org X-Mailman-Version: 2.1.12 Precedence: list List-Id: General discussion list for the Python programming language List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Newsgroups: comp.lang.python Message-ID: Lines: 30 NNTP-Posting-Host: 2001:888:2000:d::a6 X-Trace: 1315318727 news.xs4all.nl 2541 [2001:888:2000:d::a6]:52598 X-Complaints-To: abuse@xs4all.nl Xref: x330-a1.tempe.blueboxinc.net comp.lang.python:12835 On 2011-09-06 15:42, Kayode Odeyemi wrote: > I was able to get this solved by calling class like this: > > >>> from core.fleet import Fleet > >>> f = Fleet() > > Thanks to a thread from the list titled "TypeError: 'module' object is > not callable" Or you can also do this: import core.fleet # import module core.fleet under the name core.fleet f = core.fleet.Fleet() Please note that the import statement imports the module with the given name. So for example import x.y.z will import the name "x.y.z". Anything that is in module "z" will be available through its module, that is "x.y.z". Whenever you use "import ", you have to access module contents through "". You can change the name: import core.fleet as c # import module core.fleet under the name c f = c.Fleet()