moosefist
moosefist

Reputation: 11

Manually running python3 script and commands from shell console

https://github.com/dtcarls/ff_bot https://github.com/dtcarls/ff_bot/blob/master/ff_bot/ff_bot.py

I am trying to figure out a way to manually have this python script run certain functions, like get_trophies from the terminal. Currently the script is scheduled to send certain messages each week, at a specific time, but I would really like to be able to manually resend the message through the shell.

Something like "python3 ff_bot.py get_trophies" and have the bot send that message again.

Not sure if this is possible, and I am very limited in my programming knowledge. The app was auto deployed to heroku per the readme on GitHub

Upvotes: 1

Views: 580

Answers (2)

Swift
Swift

Reputation: 1711

python -3 <script name> *args **kwargs 

Anything wrong with that?

If it's part of a module

python -3 -m module.script_name *args **kwargs

Alternatively you could do:

from ff_bot import get_trophies

If you put that into your own .py file you will be able to use the function stand alone (providing you don't need to import other things too!)

HTH!

Upvotes: 1

krypterro
krypterro

Reputation: 429

If you are on Linux you can just use the command line to run the python script as you have described, if you are on Windows, and Python is in your path, you can double-click on the script to run it. Beyond that, you just add the command line argument after the script name: python script.py arg1 arg2

Upvotes: 0

Related Questions