Added an example of importing a user created file

This commit is contained in:
2019-01-06 11:28:25 -05:00
parent 630bf0719d
commit d9413e7c1b
2 changed files with 18 additions and 0 deletions

11
fileAdd.py Normal file
View File

@@ -0,0 +1,11 @@
#This is a simple test on how to import files and use their functions and classes in python
#Import the functions from the file
#These first two import specific functions from a file
#from testImport import testFunction
#from testImport import testFunction2
#This command imports every function in the file
from testImport import *
print(testFunction())
print("The output of the second function is " + str(testFunction2(3, 4)))

7
testImport.py Normal file
View File

@@ -0,0 +1,7 @@
#This is a file with a few functions in it and is used as a test for the fileAdd.py file
def testFunction():
return "This is the test function"
def testFunction2(num1, num2):
return num1 + num2