-1

i.e the first module I try to import does not work but the others work. I know it's a problem with the module in the first position because I switched them and each time, when in the first position I get an AttributeError saying that the 'module' object has no attribute ' '. Here's an example of how I import them:

from os import name, system #Note, this import comes before the other three below.
import product as p #The module in this position returns an attribute error
import rewards as r
import sale as s

I also tried importing them this way but the module first imported still does not work:

import product as p, rewards as r, sale as s
  • 1
    The code you posted does not appear capable of generating the error you report. I suspect that something's going wrong with an import inside of one of your modules - perhaps something that they all import, so that whichever one you import first triggers the failure. The FULL error traceback (not just an excerpt from it) may give a hint as to the location of the actual problem. – jasonharper Nov 22 '16 at 03:06
  • @jasonharper It's not the code because in a full block (all functions in one file) it runs perfectly fine. The `main` module (where I am trying to import the modules to) however does return a `Refactor` message of `Too many statements` in the `main` module. Could it be that? – trayceetrace Nov 22 '16 at 12:23

1 Answers1

0

AttributeError: 'module' object has no attribute <<<-This link answered my question. I discovered I had mutual top-level imports in the modules I was trying to import in the main module. Because of this I got an AttributeError like in the link.

Community
  • 1
  • 1