About 12,700,000 results
Open links in new tab
  1. python - Importing files from different folder - Stack Overflow

    If you run it from your root folder (ie. application folder), you are probably fine with sys.path.append('.') then importing the module by using from app2.some_folder.some_file …

  2. Python – Import module from different directory

    Jun 20, 2024 · In this article, we will discuss ways to import a module from another directory. Note: A module is just a Python program that ends with .py extension and a folder that …

  3. python - Import a file from a subdirectory? - Stack Overflow

    Aug 11, 2009 · Python 3.3+ has Implicit Namespace Packages that allow it to create a packages without an __init__.py file. Check Is __init__.py not required for packages in Python 3.3+. …

  4. How do I import other Python files? - Stack Overflow

    You do not have many complex methods to import a python file from one folder to another. Just create a __init__.py file to declare this folder is a python package and then go to your host file …

  5. Python 3: Import Another Python File as a Module

    Mar 25, 2021 · Python versions 3.3 and higher allow easy imports of modules in subdirectories of the current script's directory. If you're using a Python version lower than 3.3, you can follow the …

  6. How to Import Local Modules with Python - GeeksforGeeks

    Jun 28, 2024 · In this article, we will understand how to import local modules with Python. Python Modules: Think of them as individual Python files (e.g., mymodule.py) containing code to …

  7. How to Import Files From a Different Folder in Python - Squash

    Nov 2, 2023 · To import files from different folders in Python, you can use the following methods: One way to import files from a different folder is to add the folder to the system path. The …

  8. How to Import Python Files from Subdirectories - CodersLegacy

    Jul 23, 2023 · In this article, we will explore various methods to import Python files from subdirectories, providing you with a comprehensive guide to manage your project efficiently. 1. …

  9. How To Import From Another Folder In Python?

    By default Python does not allow importing files from arbitrary directories, but there is a workaround: you can add the directory to your PYTHONPATH env var or insert it into the …

  10. python - Import file from parent directory? - Stack Overflow

    I written a script py-run.py, which provides a convenient way to run Python file from any location while supporting relative imports without the need for sys.path.append. It achieves this by …

Refresh