Modules are just the folders of filing systems while their functions are the individual files.

Let's use a fictious module(book) called Dictionary.

This module has two functions: Define and Spell. We make a program where we have a user input a word and then they can click either of two buttons displayed. The two buttons are linked with two respective functions. 

This is psudeocode for simplicity:

	display(button1)
	display(button2)
	userInput = input("Please type in a word")

One button will present the definition of the word, the other will spell the word out. To provide the functionality
to those buttons we must first import the necessary module. To do this, per convention, at the top of the program we type 'from dictionary import *'
The aesterisk means wildcard or all functions within that module. 

It is best practice to only import what is needed so rather, we would put 'from dictionary import define, spell'. This simply
gives us access to what we need - the two functions (define and spell) from the dictionary module. 

	from dictionary import define, spell
	display(button1)
	display(button2)
	userInput = input("Please type in a word")

Now we have to actually connect the functions by attaching this segment of code 'define('word')' and spell('word') to both buttons.
We could also explicitly call the functions by writing 'dictionary.define('word')' if there would be an object conflict, that is, if you defined an object named 'define' or 'spell' somewhere earlier in your code. 

	from dictionary import define, spell
	display(button1)
	display(button2)
	userInput = input("Please type in a word")
	button1 = define(userInput)
	button2 = spell(userInput)

			OR

	from dictionary import define, spell
	#this is a comment and is skipped over by the interpreter. # symbol makes anything after the symbol, on that line, a comment.
	spell = 0		#therefore this works	
	define = 2		#and this works. 
	#as you can see I have already initialized spell and define as objects in my program and therefore they would cause an error if I used them for the buttons.
	display(button1)
	display(button2)
	userInput = input("Please type in a word")
	button1 = dictionary.define(userInput)
	button2 = dictionary.spell(userInput)
	

Remember, functions, objects, etc, once defined in a line of python code are universal to the function they are nested in.

So, we first import the module and its functions > display the 2 buttons > ask user to type in a word > then when the user clicks one of the two buttons, pass that typed in word into the respective function and execute it, priting out the results.


The code would be much more compex with having to form a GUI.
Here is an example of doing it strictly through command line interface using text:

	from dictionary import define, spell
	userInput = input("type in a word \n")
	userInput2 = input("Now type in 'define' or 'spell' and press enter to run that function on the word\n")
	if userInput2 == "define":
		x = define(userInput)
		print("i am defining " + userInput)
		print(x)
	elif userInput2 == "spell":
		x = spell(userInput)
		print("i am spelling " + userInput)
		print(x)
	else:
		print("You misspelled something...")

Open another cmd window by simply typing in cmd in windows search bar and opening it. Set the directory to this folder and run the above code example by typing:

py module_ex1.py