Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8024169
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 4, 20262026-06-04T22:47:07+00:00 2026-06-04T22:47:07+00:00

I have defined 2 classes- Person & Manager. The Manager inherits the Person class.

  • 0

I have defined 2 classes- Person & Manager. The Manager inherits the Person class.
I get a error while trying to import the Person class..

Code is give below.

Person.py

class Person:
    def __init__(self, name, age, pay=0, job=None):
        self.name = name
        self.age  = age
        self.pay  = pay
        self.job  = job

    def lastname(self):
        return  self.name.split()[-1]

    def giveraise(self,percent):
        #return self.pay *= (1.0 + percent)
        self.pay *= (1.0 + percent)
        return self.pay

Manager.py

from Basics import Person

class Manager(Person):
    def giveRaise(self, percent, bonus=0.1):
        self.pay *= (1.0 + percent + bonus)        
        return self.pay

Error statements:

C:\Python27\Basics>Person.py

C:\Python27\Basics>Manager.py
Traceback (most recent call last):
File “C:\Python27\Basics\Manager.py”, line 1, in
from Basics import Person
ImportError: No module named Basics

Why do I get the No module found error?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-04T22:47:09+00:00Added an answer on June 4, 2026 at 10:47 pm

    You should look up how import and PYTHONPATH work. In your case, you can solve that using:

    from Person import Person
    

    I see you’re coming from a Java background (where each file must have a class with the same name of the file), but that’s not how Python modules work.

    In short, when you run a Python script from the command line, as you did, it looks for modules (among other places) in your current dir. When you import a (simple) name like you did, Python will look for:

    1. A file named Basic.py; or:
    2. A folder named Basic with a file named __init__.py.

    Then it will look for a definition inside that module named Person.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have these classes: public class Person { public int Id{ get; set ;}
I have defined an Event class: Event and all the following classes inherit from
I have the following classes defined to do validation: public class DefValidator : IValidate<IDef>
I have two classes, user and role, defined as: public class User : Entity
Given the classes: public class Person { public string Name { get; set; }
I have defined two classes below: public class junk { private BigInteger a =
I'm using rails31 & coffeescript and have defined some classes that extend from a
Scenario: I have the following defined classes. class Baseclass { }; class DerivedTypeA :
I have the following classes: public class Person { [Key] public Guid Id {
I have two classes defined as such: public class Questionnaire { public int QuestionnaireID

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.