Search code examples
pythonimportpython-module

How to use python functions from a separate file without prefix on replit


In replit I have put my functions required to run my code in a separate file than the code itself, I have figured out how to import the code but would like to call the functions without the function prefix shown below.

import scienceFunctions
print(scienceFunctions.findElement(13))
print(scienceFunctions.findElementSymbol(15))

This is how I want to be able to call the functions

import scienceFunctions
print(findElement(13))
print(findElementSymbol(15))

Solution

  • from scienceFunctions import findElement, findElementSymbol
    # or: from scienceFunctions import *
    
    
    print(findElement(13))
    print(findElementSymbol(15))