0
class dataVerifier:
    data_list = []
    def __init__(self):
        print("Welcome...")

    def function1(self):
        print("I am in function 1")     

    def function2(self):
        print("I am in function 2")

    def function3(self):
        print("I am in function 3")

Obj = dataVerifier()

Obj.function1()

Obj.function2()

Obj.function3()
quamrana
  • 37,849
  • 12
  • 53
  • 71
Ramesh CS
  • 1
  • 2
  • https://stackoverflow.com/questions/3987041/python-run-function-from-the-command-line . Might help? – Sumit Jha Feb 25 '19 at 12:04
  • 1
    How exactly do you want to use it? Can you give some example commands? – J...S Feb 25 '19 at 12:11
  • for example, if I pass args as " python sample.py -c function2, function3, " then it should execute only function2 and function3. – Ramesh CS Feb 25 '19 at 12:15

1 Answers1

0
$ python -c 'from j import dataVerifier; ob = dataVerifier();ob.function1()'

j is the filename. This is for printing function 1. For printing all 3 functions you can use:

$ python -c 'from j import dataVerifier; ob = dataVerifier();ob.function1();ob.function2();ob.function3()'

Note: Remember to be in the same directory.

Rahil Hastu
  • 558
  • 2
  • 13