0

mypackage includes these lines:

x = 1
y = 2

Now I am trying to run foo.py that does something like the following:

import mypackage as mp
x = mp.x #works
y = mp.y #does not work

When I run foo.py, line 3 triggers the following error:

AttributeError: 'module' object has no attribute 'y'

The old version of mypackage only had x and not y. So I've tried updating it. I've tried this solution. I've tried actually running the package to regenerate the .pyc file, but no dice.

How do I get my new version of foo.py to import the new version of mypackage?

mkrieger1
  • 14,486
  • 4
  • 43
  • 54
Forklift17
  • 1,839
  • 3
  • 15
  • 27

0 Answers0