Advertisement
Felanpro

create modules

Aug 4th, 2016
117
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 0.59 KB | None | 0 0
  1. #Module
  2.  
  3. class python_module_class:
  4.     def hello(string_1):
  5.         print(string_1)
  6.  
  7.     def rand_function():
  8.         import os
  9.         rand_function_variable = os.getcwd()
  10.         print(rand_function_variable)
  11.      
  12. ------------------------------------------
  13.  
  14. #Script that imports
  15.  
  16. import pythonmodule #To import you have to put this module/script in python33/lib or in -
  17. #local scope to the script that is importing it.
  18.  
  19. pythonmodule.python_module_class.hello("Hello World!") #Module.class.function(argument)
  20.  
  21. from pythonmodule import *
  22.  
  23. python_module_class.rand_function()
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement