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
3
  • You need to provide an example for a.py and b.py file for better response Commented Aug 24, 2020 at 16:04
  • Sure it is. But we need more information on the contents of a.by and b.py and how you want to hook them up Commented Aug 24, 2020 at 16:05
  • It's called inter-process communication but it would be better if you provide more infomration about your scripts. Commented Aug 24, 2020 at 16:08

2 Answers 2

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.

Sign up to request clarification or add additional context in comments.

1 Comment

Yeah, sorry, not quite what I'm looking for.
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.

1 Comment

Hey, thanks, I just modified the post because I figured out it's not really what I wanted. A.py is actually not writable.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.