Is is possible to call a function from another file without placing from import
clause? I'd like to write Python code shorter and cleaner here, so I'm curious if there is a way to do that.
For example, usually we write like this and this works:
from tmpapp.forms import KakikomiForm
def kakikomi(request):
f = KakikomiForm()
I'd like to write something like this if possible, but this will be error:
# from tmpapp.forms import KakikomiForm
def kakikomi(request):
f = tmpapp.forms.KakikomiForm()
re
(ref: Pythonre
docs), it usually needs to be imported at some point before use. Built-in items seem to be able to be used without doing an explicit import statement, but for user defined functions, I think you'll want to use some sort of import statement. I think it helps with clarity, even if it takes more lines of code; it can help one know where something comes from in the future.