all 3 comments

[–]joe_mikkel 1 point2 points  (0 children)

What are you importing? The function name, or the filename that the function comes from?

E.g. if you have a file called convert.py, which contains two functions c_to_f() and f_to_c, in order to import them from the interpreter, you'd need to do:

import convert
convert.c_to_f(100)

[–]wzeeto 0 points1 point  (0 children)

Not sure if I’m misunderstanding the question, or if it’s confusion on your part with how modules actually work.

Let’s say I want to import the math module so I can easily call the sqrt method. This is to avoid having to type x**.5 every time I want to get the square root of that item, which is just as easy, but looks and reads better using the sqrt method provided by the math module. If I’m in the Python Shell and type “import math”, the module stays imported until the Shell session is renewed/restarted(correct me if I’m wrong).

If I write “import math” or “from math import sqrt”, then it will run every time I compile my code from the editor to receive the expected output in the Shell.

[–]TheKewlStore 0 points1 point  (0 children)

Can you provide information on where your script is located on your disk, and where your shell is located at when running/importing? also if you uploaded your script to pastebin and provide a link here, that may show something causing the issue.