> # a.py
> import b
> # refer to b.b
>
> # b.py
> import a
> # refer to a.a

Thanks Dan, but that still doesn't work for me I'm afraid...

I renamed the modules avoid name overloading -- a.py is now:
import b

class A():
    print('b.b_mod:', b.b_mod)

b is now defined, but b.b_mod isn't:
  File "main.py", line 1, in <module>
    from a import a_mod
  File "/Users/james/tmp/python/a/a_mod.py", line 3, in <module>
    class A():
  File "/Users/james/tmp/python/a/a_mod.py", line 4, in A
    print('b.b_mod:', b.b_mod)
AttributeError: 'module' object has no attribute 'b_mod'

I must be missing something here - I've tried adding the modules to
__all__ in __init__.py but that didn't help either.

James
--
http://mail.python.org/mailman/listinfo/python-list

Reply via email to