From d9413e7c1b57124f3007c9ece2735f6e2934b9cc Mon Sep 17 00:00:00 2001 From: Matthew Ellison Date: Sun, 6 Jan 2019 11:28:25 -0500 Subject: [PATCH] Added an example of importing a user created file --- fileAdd.py | 11 +++++++++++ testImport.py | 7 +++++++ 2 files changed, 18 insertions(+) create mode 100644 fileAdd.py create mode 100644 testImport.py diff --git a/fileAdd.py b/fileAdd.py new file mode 100644 index 0000000..70e91ca --- /dev/null +++ b/fileAdd.py @@ -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))) diff --git a/testImport.py b/testImport.py new file mode 100644 index 0000000..55908d7 --- /dev/null +++ b/testImport.py @@ -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