0

Dear people of the internet, I need some help... I have a Python script, main.py in which a user can enter 2 variables First, ReminderTime is an int, second, ReminderText is a string. I want to send the two variables to another Python script, reminder.py. The reminder script will do stuff with the two objects, and then it will use ToastNotifier to make a Windows notification, before shutting down. The main script will still run in the foreground during that time. Is this possible?

asked Nov 13, 2021 at 12:45

1 Answer 1

1

You can use multiprocessing

Simple example:

p = Process(target=f, args=(ReminderTime, ReminderText))
p.start()

f - is function in your reminder.py that will start that script (like main in main.py by default)
args - is all arguments you need to send to this function

Also, you need to import you function import reminder.function_name

This code will start you f function in background, so main code will still runing.

answered Nov 13, 2021 at 12:58
Sign up to request clarification or add additional context in comments.

2 Comments

It doesn't quite work, the reminder.py script doesn't run at all
@VukBajić, Can you show me your code? Use pastebin.com or equivalent.

Your Answer

Draft saved
Draft discarded

Sign up or log in

Sign up using Google
Sign up using Email and Password

Post as a guest

Required, but never shown

Post as a guest

Required, but never shown

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.