About 214,000 results
Open links in new tab
  1. python - How do I call a function from another .py file ... - Stack ...

    Define import statement in Example3.py - file for import all function. from com.my.func.DifferentFunction import * or define each function name which you want to …

  2. In Python, what happens when you import inside of a function?

    Aug 24, 2016 · The one potentially substantial advantage of having the import within a function is when that function may well not be needed at all in a given run of the program, e.g., that …

  3. module - Import functions in Python - Stack Overflow

    Apr 27, 2019 · import functions from functions import a, b, c functions.x = 1 functions.y = 2 functions.z = 3 print(a()) print(b()) print(c()) Because Python is lexically scoped, each function …

  4. python - How to use the __import__ function to import a name …

    Mar 21, 2012 · Hmm, you should be able to import foo (if you know it's value already and don't need to import it dynamically as a string value) with the normal import statement. Once the …

  5. python - Dynamically import a method in a file, from a string

    Jan 9, 2012 · From Python 2.7 you can use the importlib.import_module() function. You can import a module and access an object defined within it with the following code: from importlib …

  6. Import only functions from a python file - Stack Overflow

    May 9, 2015 · maybe if you just want to import the fun function from submission.py try. from submission import fun. To perform the function of fun, you must include the fun module. …

  7. python - Importing files from different folder - Stack Overflow

    I have this folder structure: application ├── app │ └── folder │ └── file.py └── app2 └── some_folder └── some_file.py How can I import a function from file.py, from within som...

  8. python - Importing a function from a class in another file? - Stack ...

    Note - the parts in capital letters are where you type the file name and function name. Now you just use your function however it was meant to be. Example: FUNCTION SCRIPT - saved at …

  9. python - `from ... import` vs `import .` - Stack Overflow

    Feb 25, 2012 · It depends on how you want to access the import when you refer to it. from urllib import request # access request directly. mine = request() import urllib.request # used as …

  10. Python: Can't import a function from another.py file

    I have a file named handshake.py. Where there is a function send_data(argument). I want to import that function into another file named siptest.py. I am encountering two problems. I am …

Refresh