About this question
I am new to python scripting. Can anyone tell what is the difference between a module and a script in python?
I am new to python scripting. Can anyone tell what is the difference between a module and a script in python?
Log in to share your answer and help other learners.
Log in to answerBest Answer · By JanBask Python Expert
Answered on Jul 26, 2021
A script is used to automate certain tasks in a program. It can run by itself and it is less code intensive whereas modules in python is referred as a library which can not run by its own. It needs to get imported in order to use it.
Scripting in python language uses an Interpreter to translate its source code. The interpreter reads and executes each line of code one at a time, just like a SCRIPT for a play or an audition, hence the term "scripting language".
Python uses an interpreter to translate and run its code and that's why it's called a scripting language
A Python script normally can be full of functions that can be imported as a library of functions in other scripts, or a python script can be a command that runs in Rhino.
There is a way to have Python definitions be both a library of functions and a direct command.
The key is to add these statements to the end of the file:
if __name__ == '__main__': CreateCircle() # Put the a call to the main function in the file
Free tutorials and interview questions from industry experts — learn the skill, then get ready to prove it.
Most-read guides across JanBask
Common Python interview questions, answered
Guides, tips and career advice on Python from JanBask experts.
Python How to Become a Python Developer: A Step-by-Step Guide for Beginners
Discover how to become a Python Developer via a practical 7-step guide build projects, maintain clean code, practice daily, and…
Python PCEP Certification Guide: Entry-Level Python Programmer Certification
Explore this PCEP certification guide for insights on cost, exam format, passing score, application, training, and study tips.…
Python Top 50+ Python Projects ideas for Beginners to Advanced
Discover innovative Python project ideas, explore advanced Python projects, and find good Python projects for beginners and…
Python How To Comment Out Multiple Lines In Python Like A Pro
Commenting out code is a common practice among programmers. It allows you to temporarily disable parts of your code without…