0

I have two Python scripts, a.py and b.py. A.py is running and is not writable and I would like to have b.py being able to retrieve data from it, like a list of used variables and their values, functions, class... I am finding nothing on the Internet so is this possible ? Thanks.

Example a.py

def numberOne(var):
    var1 = input('Enter a value : ')

class testClass():
    def __init__(self, value)
        self.var2 = value

var3 = 12345

Example b.py output

Found class : 
-- testClass

Found functions :
-- numberOne

Found vars :
-- var3 : 12345

2 Answers2

0

Might not be what you want but
You could try writing the data you need from a.py to c.py while a.py is running.

f = open('text.txt', 'w')
f.write(what_you_want_to_write)

And then work with it in b.py.

Maxiboi
  • 150
  • 1
  • 8
0

There should be an IPC (inter-process communication) between a.py and b.py.

In module a.py, you should have some line of codes getting all function, variable in a.py, then transmit these data to b.py via IPC. Please refer to this link for getting the function list in a module.

Shymaxtic
  • 3
  • 2
  • 3