0

I have these files:

my_modules/
  __init__.py
  sys.py

In sys.py:

import sys

def foo():
    print sys.path

In Python, I:

> import my_modules.sys
> foo()

It doesn't work and I get an error message because the sys imported by my_modules.sys is itself. I want to import the top-level sys. How do I do that?

BTW, I'm using Python 2.7, but a solution that also works for Python 2.6 is preferable.

Joshua Chia
  • 1,760
  • 2
  • 16
  • 27

0 Answers0