Welcome to the VanDyke Software Forums

Join the discussion today!


Go Back   VanDyke Software Forums > Scripting

Reply
 
Thread Tools Rate Thread Display Modes
  #1  
Old 01-17-2020, 03:57 AM
Neisany Neisany is offline
Registered User
 
Join Date: Feb 2019
Posts: 14
call script.py

is there any esay way to call a python script into the script thats running

file 1
main.py
Code:
# $language = "python"
# $interface = "1.0"

crt.Screen.Synchronous = True

main():

  import os
  strHome = os.path.expanduser('~')
  strPathToFile = "{0}/Documents/test1.py".format(strHome)
  strPathToFile = strPathToFile.replace('\\','/')
  

  run(strPathToFile)   <-- this is where I need help
I am looking to call different files to make the script modular and update-able easily. The second reason is some parts of the script will run independently of the main sub and will not want to use the main.

second file
test1.py
Code:
# $language = "python"
# $interface = "1.0"

crt.Screen.Synchronous = True

def main():
	crt.Dialog.MessageBox("hello world")

main()
Reply With Quote
  #2  
Old 01-17-2020, 09:14 AM
bgagnon bgagnon is offline
VanDyke Technical Support
 
Join Date: Oct 2008
Posts: 4,154
Hi Neisany,

It's more a Python question than a SecureCRT question, but when I googled it, the answer was to use import. I hope this helps.
__________________
Thanks,
--Brenda

VanDyke Software
Technical Support
support@vandyke.com
(505) 332-5730
Reply With Quote
Reply


Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Thread Tools
Display Modes Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT -6. The time now is 07:19 AM.