import - Importing variables from python scripts dynamically -


how include var file in recursive function?

what have far:

#!/usr/bin/python3 import sys  def parsefile(pathtofile : str):     print(pathtofile)     filevars = __import__(pathtofile, none, none, ['filelist'], 0)             file in filevars.filelist:             parsefile(file)  parsefile(sys.argv[1]) 

there 2 problems code:

  • the include statement executes imported script (i don't want change script).
  • it doesn't find files in subfolders.

i don't want parse file manually , want refrain including dependencies if possible.

i know above hacky. question is: (how) can accomplish want amount of hacking cleaner overall writing/including (external) parser.

you must create file named __init__.py in subfolders. can empty.


Comments

Popular posts from this blog

python Tkinter Capturing keyboard events save as one single string -

android - InAppBilling registering BroadcastReceiver in AndroidManifest -

javascript - Z-index in d3.js -