python: import remote file as module

 

the 'dumb' solution i found was to download the module from the remote server, importing and deleting.

i'm doing this on a specific application where i need to run python program on a windows computer, so i'm downloading from a linux server to a windows 10 pc.

 

os.system('scp -r USER@REMOTE_IP:/PATH/TO/REMOTE/FILE.py C:/PATH/TO/LOCAL/LOCAL_DIRECTORY/')

from LOCAL_DIRECTORY.FILE import *

os.system('cd C:/PATH/TO/LOCAL/LOCAL_DIRECTORY/ & del FILE.py')

Leave a Reply

Your email address will not be published. Required fields are marked *