I am relatively new to python. I am calling a a function from another script (imported) from the python shell. However, when I call a variable created in that function (after calling it) the variable hasn't been defined. I thought it was a global issue so I made the variable global in the function but it still is not defined after i call the function. When I put the function right into the python shell it works and the variable is defined. How can I access a variable created in a function in an imported script?
bikehike90
0
Newbie Poster
Recommended Answers
Jump to PostLet's use the cmath module for an example.
If you import cmath, there are two variables: e and pi.
If you type:
>>> print pi
You get the following error in IDLE:Traceback (most recent call last): File "<pyshell#3>", line 1, in <module> print …
All 2 Replies
Reply to this topic
Be a part of the DaniWeb community
We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.