0

I have three Python scripts: aaa.py, bbb.py and ccc.py.

bbb.py:

import aaa as a

ccc.py:

import bbb as b

Can I use variable a directly in ccc.py? Like a.hello?

Or can any one please tell me how to access it?

3
  • 1
    In cccp.py, it should be available as b.a.hello Commented Dec 11, 2013 at 9:05
  • To use it as a, just use this: a = b.a ;-) Commented Dec 11, 2013 at 9:23
  • 1
    You can, but I wouldn't call this good practice. Import what you need explicitly. Commented Dec 11, 2013 at 9:28

1 Answer 1

2

The ansewr should be yes.

import bbb as b
hello = b.a.hello
Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.