File imports can be scheduled to be executed regularly using for example Windows Task Scheduler. Follow these steps:

  1. Open the Task Scheduler application
  2. Select Create Basic Task
  3. Specify name and task trigger (interval)
  4. Select the Start program action
  5. Set Program/script to the pythonw.exe located in the virtual environment you want to use (i.e. <path to venv>\scripts\pythonw.exe
  6. Set Add arguments to your Python import script


Test your script from the command prompt before scheduling it to make sure it works properly.


When running with pythonw.exe, no console window will be displayed so you'll not get much feedback as to what's going on. This is probably what you want in production scenarios where you can use logs to report errors.

While you're setting up the scheduled task you can use python.exe instead. This displays a console window where you can see print() statements and even debug your scripts from within the task scheduler.


Unless you point out a specific starting or working folder for the scheduled task it will be C:\.

  • Last modified: 6 years ago
  • (external edit)