matousc
matousc

Reputation: 3977

Virtual environment - how to import in imported local module?

I have files (in virtual environment folder with Python34) like this:

myfolder/
    __init__.py
    other_file.py
test.py

If I call test.py, it imports myfolder and the __init__.py import functions fromother_file.py with

from other_file import a, b, c

This throws error:

ImportError: No module named 'other_file'

Scripts without import of local files work with this virtual env. It also works with Pyton27 without virtual env.

What I am doing wrong? Is it problem of virtual env? Does it allow to import from local modules (not installed)? Or is it difference between Python27 and Python34?

Thanks in advance.

Upvotes: 1

Views: 2693

Answers (1)

EbraHim
EbraHim

Reputation: 2359

Try this:

from myFolder.other_file import a, b, c

Upvotes: 1

Related Questions