About 590,000 results
Open links in new tab
  1. python module __init__ function - Stack Overflow

    Mar 8, 2015 · The import statement uses the builtin __import__ function. Therefore it's not possible to have a module __init__ function. You'll have to call it yourself: import mymodule …

  2. 6. ModulesPython 3.13.3 documentation

    3 days ago · A module is a file containing Python definitions and statements. The file name is the module name with the suffix .py appended. Within a module, the module’s name (as a string) …

  3. What is __Init__.Py File in Python? - GeeksforGeeks

    Mar 19, 2024 · One of the features of Python is that it allows users to organize their code into modules and packages, which are collections of modules. The __init__.py file is a Python file …

  4. How to create a Python Package with __init__.py

    Nov 5, 2024 · Creating a package with __init__.py is all about making it easier to develop larger Python projects. It provides a mechanism for you to group separate python scripts into a single …

  5. Python __init__.py: Complete Guide - ZetCode

    Mar 25, 2025 · Here, we explore how __init__.py manages imports to simplify a package's API. Examples include exposing module functions and controlling wildcard imports. This example …

  6. Python __init.py__: A Concise Guide to Module Initialization

    Jun 20, 2023 · When you create a Python package, placing an __init__.py file in the package’s directory is crucial for package initialization. It typically contains import statements for the …

  7. Python __init__.py – Best Practices and Customizations

    Dec 11, 2023 · The __init__.py file is a special Python script that is executed when a package or module is imported. Its primary purpose is to initialize the package or module and define the …

  8. Creating Python Modules and Packages Guide - PyTutorial

    May 10, 2025 · What Are Python Packages? Packages are collections of modules. They help organize related modules together. A package is a directory with a special file. The key file is …

  9. How to properly set up an __init__.py file in a Python package

    Import specific functions or classes from modules; Define package-level variables; Perform initialization tasks when the package is imported; Making Functions Available at the Package …

  10. python - What is __init__.py for? - Stack Overflow

    Jan 15, 2009 · Files named __init__.py are used to mark directories on disk as Python package directories. If you have the files. and mydir is on your path, you can import the code in …