Skip to content

How can we import python files? #145

Answered by cjdoris
CaiYitao asked this question in Q&A
Discussion options

You must be logged in to vote

In Python, do don't import files, you import packages. Either:

  • Turn your file into a package and import that.
  • If you just want to execute the contents of the file, you can do something like pyexec(read("my_python_file.py")).

Replies: 1 comment 3 replies

Comment options

You must be logged in to vote
3 replies
@CaiYitao
Comment options

@cjdoris
Comment options

@CaiYitao
Comment options

Answer selected by CaiYitao
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
2 participants