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 8636469
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 12, 20262026-06-12T10:14:12+00:00 2026-06-12T10:14:12+00:00

I created a package, for the ease of use I call it packageA. In

  • 0

I created a package, for the ease of use I call it packageA.

In this package I have 4 submodules in (separate files) and an init file, so the package contains the following files:

  • __init__.py
  • moduleA.py
  • moduleB.py
  • moduleC.py
  • moduleD.py

Module B-D stand alone, they don’t import any other local module. Module A imports module B-D.

Now I have a script that wants to import packageA, the init.py is empty so far.

import packageA

works without problems. But moduleA is not available from this import. If I want to use it via packageA.moduleA it raises this error:

AttributeError: 'module' object has no attribute

The following also works without problems:

from packageA import moduleB
from packageA import moduleC
from packageA import moduleD

And the next import causes the ImportError:

from packageA import moduleA

raises this Error:

Traceback (most recent call last):
File "run.py", line 19, in <module>
from packageA import moduleA
ImportError: cannot import name moduleA

I thought that maybe I’m doing sth wrong in moduleA, but even if moduleA is empty the import raises the same error. It seems like that this module can’t be imported somehow. How is this possible?

I have separete unit test files for all python modules, and yes, moduleA is working correctly without any errors.

  • 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-12T10:14:13+00:00Added an answer on June 12, 2026 at 10:14 am

    Perhaps you are importing a different version of the package from a different location. Try this in your script to make sure it is the right one — it should print the full path of the __init__.py file.

    import packageA
    print packageA.__file__
    

    Also, check if the package’s module search path has been altered. Normally this is a list that contains one element, the directory path of the package:

    print packageA.__path__
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have created a package which contains following files to install a package. setup.exe
Maybe this isn't possible due to Security implications... I have a Deployment Package created
I have created an Ubuntu package to install my RCP app. The installed files
I have created following thing in android using android compatibility support package Basically i
I've created package clarity-icon-theme ppa:jcubic/jcubicppa but only for Maverik I have lines like this
I've created nuget package with code transformation. My package contains several source files (which
I have created a (SSIS) package which contains SQL procedures for transfer of data
I m working with SSIS I have created a package to modify a file
I have created a java project following these steps: 1.File->java project 2. Created the
I have created ssis package that is taking data from excel file and insert

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.