About 10,000,000 results
Open links in new tab
  1. How do I import other Python files? - Stack Overflow

    How do I import files in Python? I want to import: a file (e.g. file.py) a folder a file dynamically at runtime, based on user input one specific part of a file (e.g. a single function)

  2. python - What exactly does "import *" import? - Stack Overflow

    Mar 2, 2010 · In Python, what exactly does import * import? Does it import __init__.py found in the containing folder? For example, is it necessary to declare from project.model import __init__, …

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

    Feb 25, 2012 · I'm wondering if there's any difference between the code fragment from urllib import request and the fragment import urllib.request or if they are interchangeable. If they are …

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

    Relative import is working for me too Version: Python 3.13.7 folder structure app/ ├─ main.py ├─ helpers/ │ ├─ my_helper_file.py ├─ venv/ # virtual environment and I import functions from …

  5. python - Why is "import *" bad? - Stack Overflow

    The only argument is that Python supports "import *" - if the consensus is that it is bad, then the feature should be removed, perhaps in Python 4 when people are expecting pain, anyway.

  6. How to fix "ImportError: No module named ..." error in Python?

    A better fix than setting PYTHONPATH is to use python -m module.path This will correctly set sys.path[0] and is a more reliable way to execute modules. I have a quick writeup about this …

  7. How do I unload (reload) a Python module? - Stack Overflow

    Jan 13, 2009 · Python module’s code is recompiled and the module-level code re-executed, defining a new set of objects which are bound to names in the module’s dictionary by reusing …

  8. python - Module not found - "No module named" - Stack Overflow

    My issue was that it was installed for Python, but not for Python 3. To check to see if a module is installed for Python 3, run: python3 -m pip uninstall moduleName After doing this, if you find …

  9. How can I do relative imports in Python? - Stack Overflow

    In Python 2.5, you can switch import‘s behaviour to absolute imports using a from __future__ import absolute_import directive. This absolute- import behaviour will become the default in a …

  10. How to import a Python class that is in a directory above?

    Jun 28, 2009 · To load python code reliably, have that code in a module, and that module installed in python's library. Installed modules can always be loaded from the top level namespace with …