0

So I have this directory structure:

proj/
|
---/subDirA
   |
   ---__init__.py
   ---fileA.py
|
---/subDirB
   |
   ---__init__.py
   ---fileB.py
|
---start.py

So what I'm trying to do is from fileB.py import a function in FileA.py. So I tried this:

from subDirA.fileA import funct

When I do this I get the following error:

ImportError: cannot import name funct

But If I do this instead:

from subDirA.fileA import *

I dont get the error.. Can some one explain why am I getting this error?

I also tried the following without any success: (using absolute_import)

from .subDirA.fileA import funct

(The real function name is send_message())

UPDATE

Here are the real imports for better reference, in File A I have the following imports:

import pika
import logging
import tasks
import ConfigParser

and here I have a function def:

def send_message():

and in FileB I have:

from celery.utils.log import get_task_logger
from jsonpath_rw import parse
import dateutil.parser
import json
from pikahelper.rabbit import *  # Tried using send_message and it exploded, weird..

##
#  SubDirA/FileA.py => pikahelper/rabbit.py ;)
##

Also I'm calling start.py which also calls SubDirA/FileA.py for another function..

0 Answers0