Organize python modules and packages in a mess

module File that describes the processing of python script

How to import


import module_name
# module_name.some_func()Call with
from module_name import some_func
# some_func()Call with

About path

You can check the path when searching for a module below


import sys
print(sys.path)

The beginning of path is the path of the executable file. If you want to add it, use sys.path.append ("./ some_path ") etc.

package A collection of modules. __Init__.py is required in the directory that contains the modules.

How to import


import package_name.module_name
# module_name.some_func()Call with
import package_name.subpackage_name
# subpackage_name.some_func()Call with
from package import module
# module.some_func()Call with

Recommended Posts

Organize python modules and packages in a mess
Modules and packages in Python are "namespaces"
Python packages and modules
Understand Python packages and modules
MIDI packages in Python midi and pretty_midi
Python Basic Course (14 Modules and Packages)
A standard way to develop and distribute packages in Python
I wrote a class in Python3 and Java
Organize types in Python
Get an abstract understanding of Python modules and packages
Take a screenshot in Python
Create a function in Python
Create a dictionary in Python
Make a bookmarklet in Python
Stack and Queue in Python
Unittest and CI in Python
Draw a heart in Python
Temporarily save a Python object and reuse it in another Python
List method argument information for classes and modules in Python
Create code that outputs "A and pretending B" in python
I created a class in Python and tried duck typing
Just try to receive a webhook in ngrok and python
AtCoder ABC168 A case expression solved in Ruby and Python
Python a + = b and a = a + b are different
Maybe in a python (original title: Maybe in Python)
Write a binary search in Python
Difference between list () and [] in Python
[python] Manage functions in a list
Hit a command in Python (Windows)
Difference between == and is in python
View photos in Python and html
Sorting algorithm and implementation in Python
Create a DI Container in Python
Draw a scatterplot matrix in python
ABC166 in Python A ~ C problem
Manipulate files and folders in Python
About dtypes in Python and Cython
Introductory Python Modules and conditional expressions
Write A * (A-star) algorithm in Python
Assignments and changes in Python objects
Create a binary file in Python
Check and move directories in Python
Ciphertext in Python: IND-CCA2 and RSA-OAEP
Hashing data in R and Python
Solve ABC036 A ~ C in Python
Write a pie chart in Python
Write a vim plugin in Python
Write a depth-first search in Python
Function synthesis and application in Python
Implementing a simple algorithm in Python 2
Create a Kubernetes Operator in Python
Export and output files in Python
[Python] return A [or / and] B
Reverse Hiragana and Katakana in Python2.7
Solve ABC037 A ~ C in Python
Run a simple algorithm in Python
Draw a CNN diagram in Python
Reading and writing text in Python
[GUI in Python] PyQt5-Menu and Toolbar-
Create a random string in Python
Schedule a Zoom meeting in Python