Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR PYTHON

python how to be able to use any python file you made on all projects

# Step 1: Navigate to C:UsersrighAppDataLocalPackagesPythonSoftwareFoundation.Python.3.10_qbz5n2kfra8p0LocalCachelocal-packagesPython310site-packages
# Step 2: Create a new folder. The name of the folder will be what you want to call the module.
# Step 3: Inside the folder you created, create a file called "__init__.py" (Two leading underscores and two trailing underscores).
# Step 4: Inside __init__.py, store all functions and classes you will want to use for your project. You can import your module like this:
import my_module

# Tip: If you want to create more files for more functions, create another python file in the directory you created. Name it whatever you would like. (We will be using "test")
# Import your file like this:
import my_module.test
 
PREVIOUS NEXT
Tagged: #python #python #file #projects
ADD COMMENT
Topic
Name
2+7 =